class_docstr: Baseline softmax that does an output linear projection and a softmax.
  
  
      We also support LMCL (Large Margin Cosine Loss) from the CosFace paper. See
      more detailed comment in the MEVO class below.
  
      This is intended to be used with an embedding layer with shared weights.
  
  Args:
      proj_weight (nn.Parameter):
          The shared weight.
      tile_factor (int):
          Unused. It is here to make kernel init easier with MEVO.
      log_softmax (bool):
          If True, use log_softmax instead of softmax.
      margin (float):
          Used in LMCL (when scale != None). See MEVO comments for
          more details.
      scale (Optional[float]):
          Used in LMCL. If scale is None, LMCL is turned off. See
          MEVO comments for more details.
class_docstr_tok: ["Baseline","softmax","that","does","an","output","linear","projection","and","a","softmax",".","We","also","support","LMCL","(","Large","Margin","Cosine","Loss",")","from","the","CosFace","paper",".","See","more","detailed","comment","in","the","MEVO","class","below",".","This","is","intended","to","be","used","with","an","embedding","layer","with","shared","weights",".","Args",":","proj_weight","(","nn.Parameter",")",":","The","shared","weight",".","tile_factor","(","int",")",":","Unused",".","It","is","here","to","make","kernel","init","easier","with","MEVO",".","log_softmax","(","bool",")",":","If","True",",","use","log_softmax","instead","of","softmax",".","margin","(","float",")",":","Used","in","LMCL","(","when","scale","!","=","None",")",".","See","MEVO","comments","for","more","details",".","scale","(","Optional","[","float","]",")",":","Used","in","LMCL",".","If","scale","is","None",",","LMCL","is","turned","off",".","See","MEVO","comments","for","more","details","."]
docstr: Forward function that computes softmax output with the input and target.
docstr_tok: ["Forward","function","that","computes","softmax","output","with","the","input","and","target","."]
code: def forward(self, input: torch.Tensor, target: torch.Tensor) -> torch.Tensor:  # type: ignore
      """Forward function that computes softmax output with the input and target."""
      assert isinstance(input, torch.Tensor)
      assert isinstance(target, torch.Tensor)
      input, target = _reshape_inputs(input, target)
      if self.fp16:
          assert input.dtype == torch.float16
      if self.scale is not None:
          x = self.lmcl_pre_softmax(input, target)
      else:
          x = self.fc(input)
      # Note that we do softmax in FP32, which is important for numerical stability.
      if self.log_softmax:
          x = F.log_softmax(x, dim=-1, dtype=torch.float32)
      else:
          x = F.softmax(x, dim=-1, dtype=torch.float32)
      assert x.dtype == torch.float32
      return x
  
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 3 for calling the BaselineSoftmax obj's underlying member method code with example usage: obj.forward(input, target) and returns: x