class_docstr: Compute contrastive loss
  Args:
      margin (int): margin
      max_violation (int): image feature dimension
class_docstr_tok: ["Compute","contrastive","loss","Args",":","margin","(","int",")",":","margin","max_violation","(","int",")",":","image","feature","dimension"]
code: def __init__(self, margin=0, max_violation=False):
      super().__init__()
      self.sim = dot_sim
  
file_path: towhee/towhee/models/mcprop/loss.py
imports: import torch
  from torch import nn
label_desc: Use image node_id 1 to create a new ContrastiveLoss object from inherited base classes: Contrastive with example: obj = ContrastiveLoss(margin, max_violation)