class_docstr: Function to attach a pre-computed gradient to a tensor.
  Typical use case is gradient computation before calling loss.backward().
class_docstr_tok: ["Function","to","attach","a","pre-computed","gradient","to","a","tensor",".","Typical","use","case","is","gradient","computation","before","calling","loss.backward","(",")","."]
code: def forward(
      ctx,
      input_tensor: torch.Tensor,
      output_tensor: torch.Tensor,
      grad: torch.Tensor,
      mask: torch.Tensor,
  ):
      assert input_tensor.requires_grad
      assert not output_tensor.requires_grad and not grad.requires_grad
  
      ctx.save_for_backward(grad, mask)
      return output_tensor
  
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 GradInsert obj's underlying member method code with example usage: obj.forward(ctx, input_tensor, output_tensor, grad, mask) and returns: output_tensor