(query, keys)
| 218 | |
| 219 | @staticmethod |
| 220 | def l2(query, keys): |
| 221 | # query: (batch*time, dim) |
| 222 | # keys: (batch*time, k, dim) |
| 223 | # returns: (batch*time, k) |
| 224 | return torch.sum((query.unsqueeze(-2) - keys)**2, dim=-1) |
| 225 | |
| 226 | @staticmethod |
| 227 | def dotprod(query, keys): |
nothing calls this directly
no outgoing calls
no test coverage detected