class_docstr: Module for partial gradient computation.
  Useful when computing loss on batch splits to save memory.
class_docstr_tok: ["Module","for","partial","gradient","computation",".","Useful","when","computing","loss","on","batch","splits","to","save","memory","."]
code: def forward(
      self,
      input_tensor: torch.Tensor,
      targets: torch.Tensor,
      input_lengths: torch.Tensor,
      target_lengths: torch.Tensor,
  ):
      # break the gradient chain
      loc_tensor = input_tensor.detach()
      loc_tensor.requires_grad_(True)
  
      new_tensor, mask = self.func(
          loc_tensor, targets, input_lengths, target_lengths
      )
      loc_new_tensor = new_tensor.detach()
  
      new_tensor.sum().backward()
      grad = loc_tensor.grad
  
      return (
          GradInsert.apply(input_tensor, loc_new_tensor, grad, mask),
          mask,
      )
  
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 PartialGrad obj's underlying member method code with example usage: obj.forward(input_tensor, targets, input_lengths, target_lengths) and returns: GradInsert,  mask