Skip to content

Commit

Permalink
Update noise.py
Browse files Browse the repository at this point in the history
  • Loading branch information
zsdonghao committed Jul 6, 2019
1 parent 903186f commit 51902f6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tensorlayer/layers/noise.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class GaussianNoise(Layer):
The mean. Default is 0.0.
stddev : float
The standard deviation. Default is 1.0.
is_train : boolean
Is trainable layer. If False, skip this layer. default is True.
is_always : boolean
Is True, add noise for train and eval mode. If False, skip this layer in eval mode.
seed : int or None
The seed for random noise.
name : str
Expand All @@ -46,15 +46,15 @@ def __init__(
self,
mean=0.0,
stddev=1.0,
is_train=True,
is_always=True,
seed=None,
name=None, # 'gaussian_noise',
):
super().__init__(name)
self.mean = mean
self.stddev = stddev
self.seed = seed
self.is_train = is_train
self.is_always = is_always

self.build()
self._built = True
Expand All @@ -72,7 +72,7 @@ def build(self, inputs=None):
pass

def forward(self, inputs):
if self.is_train is False:
if (self.is_train and self.is_always) is False:
return inputs
else:
# noise = np.random.normal(0.0 , sigma , tf.to_int64(self.inputs).get_shape())
Expand Down

0 comments on commit 51902f6

Please sign in to comment.