Skip to content

Commit

Permalink
Map state on coverage if coverage is there. (OpenNMT#1338)
Browse files Browse the repository at this point in the history
  • Loading branch information
flauted authored and vince62s committed Mar 5, 2019
1 parent 90023eb commit 5f08809
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions onmt/decoders/decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ def _fix_enc_hidden(hidden):
def map_state(self, fn):
self.state["hidden"] = tuple(fn(h, 1) for h in self.state["hidden"])
self.state["input_feed"] = fn(self.state["input_feed"], 1)
if self._coverage and self.state["coverage"] is not None:
self.state["coverage"] = fn(self.state["coverage"], 1)

def detach_state(self):
self.state["hidden"] = tuple(h.detach() for h in self.state["hidden"])
Expand Down

0 comments on commit 5f08809

Please sign in to comment.