Skip to content

Commit

Permalink
Merge pull request keras-team#917 from contextvision/dropout
Browse files Browse the repository at this point in the history
Dropout: rescale data at training time (breaks bw compat.)
  • Loading branch information
fchollet committed Oct 30, 2015
2 parents 46bfa18 + bae645b commit 41db741
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions keras/layers/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,9 +453,7 @@ def get_output(self, train=False):
if self.p > 0.:
retain_prob = 1. - self.p
if train:
X *= self.srng.binomial(X.shape, p=retain_prob, dtype=theano.config.floatX)
else:
X *= retain_prob
X *= self.srng.binomial(X.shape, p=retain_prob, dtype=theano.config.floatX) / retain_prob
return X

def get_config(self):
Expand Down

0 comments on commit 41db741

Please sign in to comment.