class_docstr: Compute CycleConsistency loss in COOT paper (Eq. 8)
  
  Args:
      clip_emb: Embeddings of clips
      clip_mask: Mask
      clip_lens: Number of clips per each video
      sentence_emb: Embeddings of sentences
      sentence_mask: Mask for input language
      sentence_lens: Number of sentences per paragraph
  
  Outputs:
      - ** clip to clip loss**: loss tensor with shape (batch_size,).
      - ** sentence to sentence loss**: loss tensor with shape (batch_size,).
class_docstr_tok: ["Compute","CycleConsistency","loss","in","COOT","paper","(","Eq",".","8",")","Args",":","clip_emb",":","Embeddings","of","clips","clip_mask",":","Mask","clip_lens",":","Number","of","clips","per","each","video","sentence_emb",":","Embeddings","of","sentences","sentence_mask",":","Mask","for","input","language","sentence_lens",":","Number","of","sentences","per","paragraph","Outputs",":","-","*","*","clip","to","clip","loss","*","*",":","loss","tensor","with","shape","(","batch_size",",",")",".","-","*","*","sentence","to","sentence","loss","*","*",":","loss","tensor","with","shape","(","batch_size",",",")","."]
docstr: calculate the loss
docstr_tok: ["calculate","the","loss"]
code: def forward(
      self,
      clip_emb,
      clip_mask,
      clip_lens,
      sentence_emb,
      sentence_mask,
      sentence_lens,
  ):
      """calculate the loss"""
  
      clip_max_len, _ = torch.max(clip_lens, dim=-1)
      sentence_max_len, _ = torch.max(sentence_lens, dim=-1)
      clip_sentence_nn, _, _ = self._get_soft_nn(
          clip_emb, clip_mask, sentence_emb, sentence_mask
      )
      _, clip_beta, _ = self._get_soft_nn(
          clip_sentence_nn, clip_mask, clip_emb, clip_mask
      )
      clip_clip_loss = self._get_loss(
          clip_mask, clip_lens, clip_max_len, clip_beta
      )
      sentence_clip_nn, _, _ = self._get_soft_nn(
          sentence_emb, sentence_mask, clip_emb, clip_mask
      )
      _, sentence_beta, _ = self._get_soft_nn(
          sentence_clip_nn, sentence_mask, sentence_emb, sentence_mask
      )
      sentence_sentence_loss = self._get_loss(
          sentence_mask, sentence_lens, sentence_max_len, sentence_beta
      )
      return clip_clip_loss, sentence_sentence_loss
  
file_path: gluon-cv/gluoncv/torch/utils/loss.py
imports: from torch import nn
  import torch
label_desc: Use image node_id 4 for calling the CycleConsistencyCootLoss obj's underlying member method code with example usage: obj.forward(clip_emb, clip_mask, clip_lens, sentence_emb, sentence_mask, sentence_lens) and returns: clip_clip_loss,  sentence_sentence_loss