cosine_matrix_attention
[ allennlp.modules.matrix_attention.cosine_matrix_attention ]
CosineMatrixAttention Objects#
class CosineMatrixAttention(MatrixAttention)
Computes attention between every entry in matrix_1 with every entry in matrix_2 using cosine similarity.
Registered as a MatrixAttention
with name "cosine".
forward#
| @overrides
| def forward(
| self,
| matrix_1: torch.Tensor,
| matrix_2: torch.Tensor
| ) -> torch.Tensor