Skip to content
This repository has been archived by the owner on Sep 24, 2023. It is now read-only.

Commit

Permalink
removed unnecessary detach
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinzakka committed Apr 12, 2018
1 parent 3f04ccb commit 99c4cbe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
3 changes: 0 additions & 3 deletions modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,6 @@ def forward(self, h_t):
# bound between [-1, 1]
l_t = F.tanh(l_t)

# prevent gradient flow
l_t = l_t.detach()

return mu, l_t


Expand Down
6 changes: 3 additions & 3 deletions trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ def train(self):
# evaluate on validation set
valid_loss, valid_acc = self.validate(epoch)

# reduce lr if validation loss plateaus
self.scheduler.step(valid_loss)
# # reduce lr if validation loss plateaus
# self.scheduler.step(valid_loss)

is_best = valid_acc > self.best_valid_acc
msg1 = "train loss: {:.3f} - train acc: {:.3f} "
Expand Down Expand Up @@ -293,7 +293,7 @@ def train_one_epoch(self, epoch):
(
"{:.1f}s - loss: {:.3f} - acc: {:.3f}".format(
(toc-tic), loss.data[0], acc.data[0]
)
)
)
)
pbar.update(self.batch_size)
Expand Down

0 comments on commit 99c4cbe

Please sign in to comment.