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 backward(ctx, grad_output: torch.Tensor):
      saved_grad, mask = ctx.saved_tensors
      # TODO (alaptev): make it work for grad_output with arbitrary shape
      padded_grad_output = torch.zeros(
          saved_grad.shape[0],
          dtype=grad_output.dtype,
          device=grad_output.device,
      )
      padded_grad_output[mask] = grad_output
      return (padded_grad_output * saved_grad.T).T, None, None, None
  
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 2 for calling the GradInsert obj's underlying member method code with example usage: obj.backward(ctx, grad_output) and returns: unknown,  None,  None,  None