class_docstr: Inspects a given class and collects information about its instance
  methods.
  
  Args:
      cls (Type): The class to inspect.
docstr: Inspects the function signature of :obj:`func` and returns a tuple
  of parameter types and return type.
  
  Args:
      func (callabel or str): The function.
      exclude (list[int or str]): A list of parameters to exclude, either
          given by their name or index. (default: :obj:`None`)
docstr_tok: ["Inspects","the","function","signature","of",":","obj",":","`","func","`","and","returns","a","tuple","of","parameter","types","and","return","type",".","Args",":","func","(","callabel","or","str",")",":","The","function",".","exclude","(","list","[","int","or","str","]",")",":","A","list","of","parameters","to","exclude",",","either","given","by","their","name","or","index",".","(","default",":",":","obj",":","`","None","`",")"]
code: def inspect_signature(
      self,
      func: Union[Callable, str],
      exclude: Optional[List[Union[str, int]]] = None,
  ) -> Signature:
      r"""Inspects the function signature of :obj:`func` and returns a tuple
      of parameter types and return type.
  
      Args:
          func (callabel or str): The function.
          exclude (list[int or str]): A list of parameters to exclude, either
              given by their name or index. (default: :obj:`None`)
      """
      if isinstance(func, str):
          func = getattr(self._cls, func)
      assert callable(func)
  
      if func.__name__ in self._signature_dict:
          return self._signature_dict[func.__name__]
  
      signature = inspect.signature(func)
      params = [
          p for p in signature.parameters.values() if p.name != "self"
      ]
  
      param_dict: Dict[str, Parameter] = {}
      for i, param in enumerate(params):
          if exclude is not None and (
              i in exclude or param.name in exclude
          ):
              continue
  
          param_type = param.annotation
          # Mimic TorchScript to auto-infer `Tensor` on non-present types:
          param_type = (
              Tensor if param_type is inspect._empty else param_type
          )
  
          param_dict[param.name] = Parameter(
              name=param.name,
              type=self.eval_type(param_type),
              type_repr=self.type_repr(param_type),
              default=param.default,
          )
  
      return_type = signature.return_annotation
      # Mimic TorchScript to auto-infer `Tensor` on non-present types:
      return_type = (
          Tensor if return_type is inspect._empty else return_type
      )
  
      self._signature_dict[func.__name__] = Signature(
          param_dict=param_dict,
          return_type=self.eval_type(return_type),
          return_type_repr=self.type_repr(return_type),
      )
  
      return self._signature_dict[func.__name__]
  
imports: import inspect
  import re
  import sys
  import typing
  from typing import Any, Callable, Dict, List, NamedTuple, Optional, Type, Union
  from torch import Tensor
label_desc: Use image node_id 7 for calling the Inspector obj's underlying member method code with example usage: obj.inspect_signature(func, exclude) and returns: self, self