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 _batch_unshuffle(self, x, idx_restore):
      if self.num_gpus > 1:
          if self.cfg.CONTRASTIVE.LOCAL_SHUFFLE_BN:
              x = du.cat_all_gather(x, local=True)
              gpu_idx = du.get_local_rank()
          else:
              x = du.cat_all_gather(x)
              gpu_idx = torch.distributed.get_rank()
      else:
          gpu_idx = 0
  
      idx = idx_restore[gpu_idx, :]
      x = x[idx]
      return x
  
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 6 for calling the ContrastiveModel obj's underlying member method code with example usage: obj._batch_unshuffle(x, idx_restore) and returns: x