Misc changes + make code more pythonic

This commit is contained in:
Drake Levy
2017-03-14 13:51:11 -07:00
parent 3368977b38
commit e66845dbe0
3 changed files with 45 additions and 17 deletions

View File

@@ -207,8 +207,10 @@ class FSRCNN(object):
return conv_deconv
# PreLU tensorflow implementation
def prelu(self, _x, i):
"""
PreLU tensorflow implementation
"""
alphas = tf.get_variable('alpha{}'.format(i), _x.get_shape()[-1], initializer=tf.constant_initializer(0.0), dtype=tf.float32)
pos = tf.nn.relu(_x)
neg = alphas * (_x - abs(_x)) * 0.5