(self, hidden, 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() |
| 765 | return torch.sum(self.v * energy, dim=2) |
| 766 | |
| 767 | def forward(self, hidden, encoder_outputs): |
| 768 | # Calculate the attention weights (energies) based on the given method |