Skip to content

Commit

Permalink
fix memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
Atomu2014 authored Oct 9, 2018
1 parent e832d66 commit 99d214f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pnn/tf_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@ def train_batch(self, batch_xs, batch_ys):
_loss_ = np.mean([ret[i] for i in range(1, len(ret), 3)])
_log_loss_ = np.mean([ret[i] for i in range(2, len(ret), 3)])
_l2_loss_ = np.mean([ret[i] for i in range(3, len(ret), 3)])
del train_feed
return _loss_, _log_loss_, _l2_loss_

def train(self):
Expand Down Expand Up @@ -619,6 +620,7 @@ def evaluate_batch(self, batch_xs, batch_ys):
feed_dict[model.training] = False
_preds_ = self.sess.run(fetches=fetches, feed_dict=feed_dict)
batch_preds = [x.flatten() for x in _preds_]
del feed_dict
return batch_preds

def evaluate(self, gen, writer=None, eps=1e-6, submission=0):
Expand Down

0 comments on commit 99d214f

Please sign in to comment.