class_docstr: Fused fc + softmax + nll_loss in a tiled fashion.
  
      MEVO uses much less memory but is quite a bit slower.
  
      MEVO also implements the LMCL (Large Margin Cosine Loss) function introduced by
      highly cited
      `CosFace: Large Margin Cosine Loss for Deep Face Recognition [Wang et al.]`_.
  
      .. _`CosFace: Large Margin Cosine Loss for Deep Face Recognition [Wang et al.]`: https://arxiv.org/abs/1801.09414
  
      LMCL can be turned on using the ``margin`` and ``scale`` parameters below. These
      hyperparameters most likely require tuning, depending on the number of classes etc.
  
      MEVO LMCL can be suitable for face recognition and image retrieval tasks, esp. when
      the number prediction target classes is large. MEVO is slower but can use much
      less GPU memory in that case, which enables training with larger batches. We
      hope this is helpful but we strongly recommend users (AI researchers
      and engineers) to carefully consider their applications of this technology. This
      types of technology should not be used by small group of people exclusively to
      potentially harm the general public.
  
  Args:
      proj_weight (nn.Parameter):
          Sharing this weight with an embedding layer.
      tile_factor (int):
          Number of splits to use on the input sequence and vocab dimensions.
          Default: 16
      reduction (str):
          Reduction OP (sum or mean).
          Default: sum
      margin (float):
          Hyperparameter of the separation margin between classes. See the
          appendix of the CosFace paper for a formula on how to compute its
          value properly. The default value is unlikely to be suitable in all
          cases.
          Default: 0.35
      scale (Optional[float]):
          Hyperparameter of the feature-vector-scaling for LMCL. When not
          supplied, LMCL is turned off. See the appendix of the CosFace paper for
          a formula on how to compute its value properly.
          Default: None
class_docstr_tok: ["Fused","fc","+","softmax","+","nll_loss","in","a","tiled","fashion",".","MEVO","uses","much","less","memory","but","is","quite","a","bit","slower",".","MEVO","also","implements","the","LMCL","(","Large","Margin","Cosine","Loss",")","function","introduced","by","highly","cited","`","CosFace",":","Large","Margin","Cosine","Loss","for","Deep","Face","Recognition","[","Wang","et","al.","]","`","_",".","..","_","`","CosFace",":","Large","Margin","Cosine","Loss","for","Deep","Face","Recognition","[","Wang","et","al",".","]","`",":","https",":","\/\/arxiv.org\/abs\/1801.09414","LMCL","can","be","turned","on","using","the","``","margin","``","and","``","scale","``","parameters","below",".","These","hyperparameters","most","likely","require","tuning",",","depending","on","the","number","of","classes","etc",".","MEVO","LMCL","can","be","suitable","for","face","recognition","and","image","retrieval","tasks",",","esp",".","when","the","number","prediction","target","classes","is","large",".","MEVO","is","slower","but","can","use","much","less","GPU","memory","in","that","case",",","which","enables","training","with","larger","batches",".","We","hope","this","is","helpful","but","we","strongly","recommend","users","(","AI","researchers","and","engineers",")","to","carefully","consider","their","applications","of","this","technology",".","This","types","of","technology","should","not","be","used","by","small","group","of","people","exclusively","to","potentially","harm","the","general","public",".","Args",":","proj_weight","(","nn.Parameter",")",":","Sharing","this","weight","with","an","embedding","layer",".","tile_factor","(","int",")",":","Number","of","splits","to","use","on","the","input","sequence","and","vocab","dimensions",".","Default",":","16","reduction","(","str",")",":","Reduction","OP","(","sum","or","mean",")",".","Default",":","sum","margin","(","float",")",":","Hyperparameter","of","the","separation","margin","between","classes",".","See","the","appendix","of","the","CosFace","paper","for","a","formula","on","how","to","compute","its","value","properly",".","The","default","value","is","unlikely","to","be","suitable","in","all","cases",".","Default",":","0.35","scale","(","Optional","[","float","]",")",":","Hyperparameter","of","the","feature-vector-scaling","for","LMCL",".","When","not","supplied",",","LMCL","is","turned","off",".","See","the","appendix","of","the","CosFace","paper","for","a","formula","on","how","to","compute","its","value","properly",".","Default",":","None"]
docstr: Get target's negative log probability.
docstr_tok: ["Get","target","'s","negative","log","probability","."]
code: def get_target_nlprob(
      self,
      i: torch.Tensor,
      w: torch.Tensor,
      target: torch.Tensor,
      debase_max: torch.Tensor,
      exp_sums: torch.Tensor,
  ) -> torch.Tensor:
      """Get target's negative log probability."""
      target_score = TargetScoreFunction.apply(i, w, target, self)
      prob = (target_score - debase_max).exp() / exp_sums
      if self.log_softmax:
          # lprob
          prob = prob.log()
      # nlprob, then sum over all tokens.
      return -prob.sum()
  
imports: from typing import Any, Optional, Tuple
  import torch
  from torch import nn
  import torch.distributed
  import torch.nn.functional
label_desc: Use image node_id 2 for calling the MemoryEfficientVocabOutput obj's underlying member method code with example usage: obj.get_target_nlprob(i, w, target, debase_max, exp_sums) and returns: unknown