class_docstr: NLLLoss
class_docstr_tok: ["NLLLoss"]
docstr: Args:
      log_probs (float): output log probability tensor
      labels (long): ground truth labels
      loss_mask (bool/float/int): tensor to specify the masking
docstr_tok: ["Args",":","log_probs","(","float",")",":","output","log","probability","tensor","labels","(","long",")",":","ground","truth","labels","loss_mask","(","bool\/float\/int",")",":","tensor","to","specify","the","masking"]
code: def forward(self, log_probs, labels, loss_mask=None):
      """
      Args:
          log_probs (float): output log probability tensor
          labels (long): ground truth labels
          loss_mask (bool/float/int): tensor to specify the masking
      """
      log_probs_flatten = torch.flatten(
          log_probs, start_dim=0, end_dim=-2
      )
      labels_flatten = torch.flatten(labels, start_dim=0, end_dim=-1)
  
      if loss_mask is not None:
          if loss_mask.dtype is not torch.bool:
              loss_mask = loss_mask > 0.5
          loss_mask_flatten = torch.flatten(
              loss_mask, start_dim=0, end_dim=-1
          )
          log_probs_flatten = log_probs_flatten[loss_mask_flatten]
          labels_flatten = labels_flatten[loss_mask_flatten]
  
      if len(labels_flatten) == 0:
          return super().forward(
              log_probs, torch.argmax(log_probs, dim=-1)
          )
  
      loss = super().forward(log_probs_flatten, labels_flatten)
      return loss
  
imports: import torch
  from torch import nn
  from nemo.core.classes import Serialization, Typing, typecheck
  from nemo.core.neural_types import LabelsType, LogitsType, LogprobsType, LossType, MaskType, NeuralType
  from nemo.utils import logging
label_desc: Use image node_id 4 for calling the NLLLoss obj's underlying member method code with example usage: obj.forward(log_probs, labels, loss_mask) and returns: loss, super