MCPcopy Create free account
hub / github.com/pytorch/tutorials / general_score

Method general_score

beginner_source/chatbot_tutorial.py:759–761  ·  view source on GitHub ↗
(self, hidden, encoder_output)

Source from the content-addressed store, hash-verified

757 return torch.sum(hidden * encoder_output, dim=2)
758
759 def general_score(self, hidden, encoder_output):
760 energy = self.attn(encoder_output)
761 return torch.sum(hidden * energy, dim=2)
762
763 def concat_score(self, hidden, encoder_output):
764 energy = self.attn(torch.cat((hidden.expand(encoder_output.size(0), -1, -1), encoder_output), 2)).tanh()

Callers 1

forwardMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected