MCPcopy Index your code
hub / github.com/lisa-lab/DeepLearningTutorials / get_corrupted_input

Method get_corrupted_input

code/dA.py:196–220  ·  view source on GitHub ↗

This function keeps ``1-corruption_level`` entries of the inputs the same and zero-out randomly selected subset of size ``corruption_level`` Note : first argument of theano.rng.binomial is the shape(size) of random numbers that it should produce second a

(self, input, corruption_level)

Source from the content-addressed store, hash-verified

194 self.params = [self.W, self.b, self.b_prime]
195
196 def get_corrupted_input(self, input, corruption_level):
197 """This function keeps ``1-corruption_level`` entries of the inputs the
198 same and zero-out randomly selected subset of size ``corruption_level``
199 Note : first argument of theano.rng.binomial is the shape(size) of
200 random numbers that it should produce
201 second argument is the number of trials
202 third argument is the probability of success of any trial
203
204 this will produce an array of 0s and 1s where 1 has a
205 probability of 1 - ``corruption_level`` and 0 with
206 ``corruption_level``
207
208 The binomial function return int64 data type by
209 default. int64 multiplicated by the input
210 type(floatX) always return float64. To keep all data
211 in floatX when floatX is float32, we set the dtype of
212 the binomial to floatX. As in our case the value of
213 the binomial is always 0 or 1, this don't change the
214 result. This is needed to allow the gpu to work
215 correctly as it only support float32 for now.
216
217 """
218 return self.theano_rng.binomial(size=input.shape, n=1,
219 p=1 - corruption_level,
220 dtype=theano.config.floatX) * input
221
222 def get_hidden_values(self, input):
223 """ Computes the values of the hidden layer """

Callers 1

get_cost_updatesMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected