class_docstr: Contrastive Model, currently mainly focused on memory bank and CSC.
class_docstr_tok: ["Contrastive","Model",",","currently","mainly","focused","on","memory","bank","and","CSC","."]
code: def eval_knn(self, q_knn, knn_k=200):
      with torch.no_grad():
          dist = torch.einsum(
              "nc,mc->nm",
              q_knn.view(q_knn.size(0), -1),
              self.knn_mem.memory.view(self.knn_mem.memory.size(0), -1),
          )
          yd, yi = dist.topk(knn_k, dim=1, largest=True, sorted=True)
      return yd, yi
  
imports: import math
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  import slowfast.models.losses
  import slowfast.utils.distributed
  import slowfast.utils.logging
  from slowfast.models.video_model_builder import X3D, MViT, ResNet, SlowFast
  from .build import MODEL_REGISTRY
label_desc: Use image node_id 7 for calling the ContrastiveModel obj's underlying member method code with example usage: obj.eval_knn(q_knn, knn_k) and returns: yd,  yi