GeezerVison is showing github.com — small opt when the corruption level is 0. · hdubey/DeepLearningTutorials@5fc2b76
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: code/dA.py +3-1Lines changed: 3 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -178,6 +178,8 @@ def get_corrupted_input(self, input, corruption_level): |
178 | 178 | is always 0 or 1, this don't change the result. This is needed to allow |
179 | 179 | the gpu to work correctly as it only support float32 for now. |
180 | 180 | """ |
| 181 | + if corruption_level==0: |
| 182 | + return input |
181 | 183 | return self.theano_rng.binomial( size = input.shape, n = 1, prob = 1 - corruption_level, dtype=theano.config.floatX) * input |
182 | 184 |
|
183 | 185 |
|
@@ -261,7 +263,7 @@ def test_dA( learning_rate = 0.1, training_epochs = 15, dataset ='mnist.pkl.gz' |
261 | 263 |
|
262 | 264 | train_da = theano.function([index], cost, updates = updates, |
263 | 265 | givens = {x:train_set_x[index*batch_size:(index+1)*batch_size]}) |
264 | | - |
| 266 | + |
265 | 267 | start_time = time.clock() |
266 | 268 |
|
267 | 269 | ############ |
|