MCPcopy Create free account
hub / github.com/LUMIA-Group/MemoryDecoder / l2

Method l2

knn_utils/saveEmbedMulti.py:220–224  ·  view source on GitHub ↗
(query, keys)

Source from the content-addressed store, hash-verified

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):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected