class_docstr: Function for fast gradient normalization.
  Typical use case is normalization for mle loss.
class_docstr_tok: ["Function","for","fast","gradient","normalization",".","Typical","use","case","is","normalization","for","mle","loss","."]
code: def forward(
      ctx,
      log_probs: torch.Tensor,
      input_lengths: torch.Tensor,
      reduction: str = "mean",
  ):
      mask = make_non_pad_mask(input_lengths, log_probs.shape[1])
      probs = log_probs.exp()
      norm_probs = torch.zeros_like(log_probs)
      norm_probs[mask] += probs[mask]
      if reduction == "mean":
          norm_probs /= norm_probs.shape[0]
      ctx.save_for_backward(norm_probs)
      return log_probs
  
file_path: NeMo/nemo/collections/asr/parts/k2/grad_utils.py
imports: import torch
  from nemo.collections.asr.parts.k2.utils import make_non_pad_mask
label_desc: Use image node_id 1 for calling the GradExpNormalize obj's underlying member method code with example usage: obj.forward(ctx, log_probs, input_lengths, reduction) and returns: log_probs