Skip to content

Instantly share code, notes, and snippets.

@epwalsh
Created September 10, 2019 17:20
Show Gist options
  • Save epwalsh/9339806ef92ba3a5bd473e8beac83996 to your computer and use it in GitHub Desktop.
Save epwalsh/9339806ef92ba3a5bd473e8beac83996 to your computer and use it in GitHub Desktop.
class CopyNetSeq2Seq(Model):
# snip...
def _get_generation_scores(self, state: Dict[str, torch.Tensor]) -> torch.Tensor:
# `self._output_generation_layer` is just a PyTorch linear layer with an input
# dimension equal to the decoder hidden state size, and an output dimension
# equal to the size of the target vocabulary.
return self._output_generation_layer(state["decoder_hidden"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment