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 distributed_sinkhorn(self, Q, nmb_iters):
      with torch.no_grad():
          sum_Q = torch.sum(Q)
          du.all_reduce([sum_Q], average=False)
          Q /= sum_Q
  
          u = torch.zeros(Q.shape[0]).cuda(non_blocking=True)
          r = (
              torch.ones(Q.shape[0]).cuda(non_blocking=True)
              / Q.shape[0]
          )
          c = torch.ones(Q.shape[1]).cuda(non_blocking=True) / (
              du.get_world_size() * Q.shape[1]
          )
  
          curr_sum = torch.sum(Q, dim=1)
          du.all_reduce([curr_sum], average=False)
  
          for _ in range(nmb_iters):
              u = curr_sum
              Q *= (r / u).unsqueeze(1)
              Q *= (c / torch.sum(Q, dim=0)).unsqueeze(0)
              curr_sum = torch.sum(Q, dim=1)
              du.all_reduce([curr_sum], average=False)
          return (Q / torch.sum(Q, dim=0, keepdim=True)).t().float()
  
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 19 for calling the ContrastiveModel obj's underlying member method code with example usage: obj.distributed_sinkhorn(Q, nmb_iters) and returns: unknown