code: def assert_grad(
      self,
      transform: Callable[..., Tensor],
      inputs: Tuple[torch.Tensor],
      *,
      enable_all_grad: bool = True,
  ):
      inputs_ = []
      for i in inputs:
          if torch.is_tensor(i):
              i = i.to(
                  dtype=self.complex_dtype
                  if i.is_complex()
                  else self.dtype,
                  device=self.device,
              )
              if enable_all_grad:
                  i.requires_grad = True
          inputs_.append(i)
      assert gradcheck(transform, inputs_)
      assert gradgradcheck(transform, inputs_)
  
imports: from functools import partial
  from typing import Callable, Tuple
  import torch
  import torchaudio.functional
  from parameterized import parameterized
  from torch import Tensor
  from torch.autograd import gradcheck, gradgradcheck
  from torchaudio_unittest.common_utils import get_spectrogram, get_whitenoise, nested_params, rnnt_utils, TestBaseMixin, use_deterministic_algorithms
label_desc: Use image node_id 1 for calling the Autograd obj's underlying member method code with example usage: obj.assert_grad(transform, inputs) without return types