class_docstr: The Lightning Base module for MoCo SSL video task.
  
  For more details refer to,
  1. Momentum Contrast for unsupervised Visual Representation Learning:
      https://arxiv.org/abs/1911.05722
  2. A Large-Scale Study on Unsupervised Spatiotemporal Representation Learning
  
  Args:
      model (OmegaConf): An omega conf object intializing the neural-network modle.
          Example configs can be found in `pytorchvideo_trainer/conf/module/model`
      loss(OmegaConf): An omega conf object intializing the loss function.
          Example configs can be found in `pytorchvideo_trainer/conf/module/loss`
      optim (OmegaConf): An omega conf object for constructing the optimizer object.
          The associated config schema can be found at
          `pytorchvideo_trainer.module.optimizer.OptimizerConf`.
          Example configs can be found in `pytorchvideo_trainer/conf/module/optim`
      metrics (OmegaConf): The metrics to track, which will be used for both train,
          validation and test. Example configs can be found in
          `pytorchvideo_trainer/conf/module/metricx`
      dim (int): Dimentionality of features in the stored queue. Set to be same as
          embedding dimentions for the SSL model.
      k (int): Queue size for stored features.
      batch_suffle (bool): If true, performs shuffling of the computed keys.
      local_shuffle_bn (bool): If true, only performs shuffling of keys with in the
          current node.
      lr_scheduler (OmegaConf): An omega conf object associated with learning rate
          scheduler used during trainer.
          The associated config schema can be found at
          `pytorchvideo_trainer.module.lr_policy.LRSchedulerConf`.
          Example configs can be found in `pytorchvideo_trainer/conf/module/lr_scheduler`
      modality_key (str): The modality key used in data processing, default: "video".
      ensemble_method (str): The data ensembling method to control how we accumulate
          the testing results at video level, which is optional. Users may choose from
          ["sum", "max", None], If it is set to None, no data ensembling will be applied.
      knn_memory (OmegaConf): An optional hydra / omeaga conf, if set, initializes KNN
          Memory module to use. Example config can be found at,
          `pytorchvideo_trainer/conf/module/knn_memory`.
      momentum_anneal_cosine (bool): For MoCo and BYOL tasks, if set to true, cosine
          anneals the momentum term used from updating the backbone-history model.
      num_sync_devices (int): Number of gpus to sync bathcnorm over. Only works if
          pytorch lightning trainer's sync_batchnorm parameter is to false.
class_docstr_tok: ["The","Lightning","Base","module","for","MoCo","SSL","video","task",".","For","more","details","refer","to",",","1",".","Momentum","Contrast","for","unsupervised","Visual","Representation","Learning",":","https",":","\/\/arxiv.org\/abs\/1911.05722","2",".","A","Large-Scale","Study","on","Unsupervised","Spatiotemporal","Representation","Learning","Args",":","model","(","OmegaConf",")",":","An","omega","conf","object","intializing","the","neural-network","modle",".","Example","configs","can","be","found","in","`","pytorchvideo_trainer\/conf\/module\/model","`","loss","(","OmegaConf",")",":","An","omega","conf","object","intializing","the","loss","function",".","Example","configs","can","be","found","in","`","pytorchvideo_trainer\/conf\/module\/loss","`","optim","(","OmegaConf",")",":","An","omega","conf","object","for","constructing","the","optimizer","object",".","The","associated","config","schema","can","be","found","at","`","pytorchvideo_trainer.module.optimizer.OptimizerConf","`",".","Example","configs","can","be","found","in","`","pytorchvideo_trainer\/conf\/module\/optim","`","metrics","(","OmegaConf",")",":","The","metrics","to","track",",","which","will","be","used","for","both","train",",","validation","and","test",".","Example","configs","can","be","found","in","`","pytorchvideo_trainer\/conf\/module\/metricx","`","dim","(","int",")",":","Dimentionality","of","features","in","the","stored","queue",".","Set","to","be","same","as","embedding","dimentions","for","the","SSL","model",".","k","(","int",")",":","Queue","size","for","stored","features",".","batch_suffle","(","bool",")",":","If","true",",","performs","shuffling","of","the","computed","keys",".","local_shuffle_bn","(","bool",")",":","If","true",",","only","performs","shuffling","of","keys","with","in","the","current","node",".","lr_scheduler","(","OmegaConf",")",":","An","omega","conf","object","associated","with","learning","rate","scheduler","used","during","trainer",".","The","associated","config","schema","can","be","found","at","`","pytorchvideo_trainer.module.lr_policy.LRSchedulerConf","`",".","Example","configs","can","be","found","in","`","pytorchvideo_trainer\/conf\/module\/lr_scheduler","`","modality_key","(","str",")",":","The","modality","key","used","in","data","processing",",","default",":","``","video","''",".","ensemble_method","(","str",")",":","The","data","ensembling","method","to","control","how","we","accumulate","the","testing","results","at","video","level",",","which","is","optional",".","Users","may","choose","from","[","``","sum","''",",","``","max","''",",","None","]",",","If","it","is","set","to","None",",","no","data","ensembling","will","be","applied",".","knn_memory","(","OmegaConf",")",":","An","optional","hydra","\/","omeaga","conf",",","if","set",",","initializes","KNN","Memory","module","to","use",".","Example","config","can","be","found","at",",","`","pytorchvideo_trainer\/conf\/module\/knn_memory","`",".","momentum_anneal_cosine","(","bool",")",":","For","MoCo","and","BYOL","tasks",",","if","set","to","true",",","cosine","anneals","the","momentum","term","used","from","updating","the","backbone-history","model",".","num_sync_devices","(","int",")",":","Number","of","gpus","to","sync","bathcnorm","over",".","Only","works","if","pytorch","lightning","trainer","'s","sync_batchnorm","parameter","is","to","false","."]
code: def _compute_keys(self, x: torch.Tensor) -> List[torch.Tensor]:
      keys = []
      for sub_x in x:
          if self.batch_shuffle_on:
              with torch.no_grad():
                  sub_x, idx_restore = self._batch_shuffle(sub_x)
          with torch.no_grad():
              # pyre-ignore[29]
              key = self.model.forward_backbone_mmt(sub_x).detach()
  
          if self.batch_shuffle_on:
              key = self._batch_unshuffle(key, idx_restore).detach()
          keys.append(key)
      return keys
  
imports: import math
  from dataclasses import dataclass
  from typing import Any, Callable, List, Optional, Tuple, Union
  import pytorchvideo_trainer.module.distributed_utils
  import torch
  import torch.nn
  import torch.nn.functional
  from hydra.core.config_store import ConfigStore
  from omegaconf import MISSING
  from pytorchvideo.models.resnet import create_resnet
  from pytorchvideo.models.weight_init import init_net_weights
  from pytorchvideo_trainer.module.ssl_helper import create_mlp_util, SSLBaseModule
  from pytorchvideo_trainer.module.video_classification import Batch, BatchKey, EnsembleMethod
  from torchrecipes.core.conf import ModuleConf
  from torchrecipes.utils.config_utils import get_class_name_str
label_desc: Use image node_id 5 for calling the MOCOV2Module obj's underlying member method code with example usage: obj._compute_keys(x) and returns: keys