class_docstr: MaxMarginRanking loss used in COOT paper (Eq. 1): https://arxiv.org/abs/2011.00597
  Inputs:
      - x_embedding: the embedding tensor for a modality with shape (Batch x feature_dimension).
      - y_embedding: the embedding tensor for another input modality with same shape of x_embedding.
        i.e. in COOT paper x_embedding could be video features and y_embedding language features.
      - margin: constant margin in eq. 1 of COOT paper.
  Outputs:
      - **loss**: loss tensor with shape (batch_size,).
class_docstr_tok: ["MaxMarginRanking","loss","used","in","COOT","paper","(","Eq",".","1",")",":","https",":","\/\/arxiv.org\/abs\/2011.00597","Inputs",":","-","x_embedding",":","the","embedding","tensor","for","a","modality","with","shape","(","Batch","x","feature_dimension",")",".","-","y_embedding",":","the","embedding","tensor","for","another","input","modality","with","same","shape","of","x_embedding",".","i.e",".","in","COOT","paper","x_embedding","could","be","video","features","and","y_embedding","language","features",".","-","margin",":","constant","margin","in","eq",".","1","of","COOT","paper",".","Outputs",":","-","*","*","loss","*","*",":","loss","tensor","with","shape","(","batch_size",",",")","."]
docstr: calculate cosine similarity
docstr_tok: ["calculate","cosine","similarity"]
code: def _cosine_sim(self, embedding_x1, embedding_x2):
      """calculate cosine similarity"""
      return embedding_x1.mm(embedding_x2.t())
  
file_path: gluon-cv/gluoncv/torch/utils/loss.py
imports: from torch import nn
  import torch
label_desc: Use image node_id 2 for calling the MaxMarginRankingLoss obj's underlying member method code with example usage: obj._cosine_sim(embedding_x1, embedding_x2) and returns: embedding_x1