parameters: (
      mod: torch.nn.Module, path: str, example_inputs: Any
  )
return_statement: return sub_inputs
docstring: r"""Get the inputs of a submodule given the top-level model
      and its input.
  
      Register a forward hook that record the inputs of the submodule
      and then run the model to triger the hook.
  
      Args:
          mod: top-level model
          path: path to a submodule
          example_inputs: inputs to the top-level model
  
      Return:
          inputs: Tuple[torch.Tensor]
docstring_summary: r"""Get the inputs of a submodule given the top-level model
      and its input.
docstring_tokens: r Get the inputs of a submodule given the top - level model and its input .
function: def get_submod_inputs(
      mod: torch.nn.Module, path: str, example_inputs: Any
  ) -> Tuple[torch.Tensor]:
      r"""Get the inputs of a submodule given the top-level model
      and its input.
  
      Register a forward hook that record the inputs of the submodule
      and then run the model to triger the hook.
  
      Args:
          mod: top-level model
          path: path to a submodule
          example_inputs: inputs to the top-level model
  
      Return:
          inputs: Tuple[torch.Tensor]
      """
      submod = get_submodule(mod, path)
      sub_inputs = None
  
      def get_inputs(self: torch.nn.Module, inputs: Any):
          nonlocal sub_inputs
          sub_inputs = inputs
  
      handle = submod.register_forward_pre_hook(get_inputs)
      mod(*example_inputs)
      handle.remove()
      return sub_inputs
function_tokens: def get_submod_inputs ( mod : torch . nn . Module , path : str , example_inputs : Any ) -> Tuple [ torch . Tensor ] : submod = get_submodule ( mod , path ) sub_inputs = None def get_inputs ( self : torch . nn . Module , inputs : Any ) : nonlocal sub_inputs sub_inputs = inputs handle = submod . register_forward_pre_hook ( get_inputs ) mod ( * example_inputs ) handle . remove ( ) return sub_inputs