Skip to content

Commit 5fc2b76

Browse files
author
bastienf
committed
small opt when the corruption level is 0.
1 parent 879bf88 commit 5fc2b76

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

code/dA.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ def get_corrupted_input(self, input, corruption_level):
178178
is always 0 or 1, this don't change the result. This is needed to allow
179179
the gpu to work correctly as it only support float32 for now.
180180
"""
181+
if corruption_level==0:
182+
return input
181183
return self.theano_rng.binomial( size = input.shape, n = 1, prob = 1 - corruption_level, dtype=theano.config.floatX) * input
182184

183185

@@ -261,7 +263,7 @@ def test_dA( learning_rate = 0.1, training_epochs = 15, dataset ='mnist.pkl.gz'
261263

262264
train_da = theano.function([index], cost, updates = updates,
263265
givens = {x:train_set_x[index*batch_size:(index+1)*batch_size]})
264-
266+
265267
start_time = time.clock()
266268

267269
############

0 commit comments

Comments
 (0)