Skip to content

Commit

Permalink
Fix memory leak
Browse files Browse the repository at this point in the history
The scan in get_output TimeDistributedDense leaked memory like crazy. Changing it to match get_output in Dense seems to have fixed the problem and behaves identically.
  • Loading branch information
the-moliver committed Jun 26, 2015
1 parent 7fafc8e commit 3ff19e2
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions keras/layers/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,13 +312,7 @@ def __init__(self, input_dim, output_dim, init='glorot_uniform', activation='lin

def get_output(self, train):
X = self.get_input(train)

def act_func(X):
return self.activation(T.dot(X, self.W) + self.b)

output, _ = theano.scan(fn = act_func,
sequences = X.dimshuffle(1,0,2),
outputs_info=None)
output = self.activation(T.dot(X.dimshuffle(1,0,2), self.W) + self.b)
return output.dimshuffle(1,0,2)

def get_config(self):
Expand Down

0 comments on commit 3ff19e2

Please sign in to comment.