class_docstr: Implementation of PureFunction for torch.nn.Module.
  
  Examples
  --------
  >>> import torch
  >>> from deepchem.utils.differentiation_utils import get_pure_function
  >>> class A(torch.nn.Module):
  ...     def __init__(self, a):
  ...         super().__init__()
  ...         self.b = torch.nn.Parameter(torch.tensor(a*a))
  ...     def forward(self, x):
  ...         return self.b * x
  >>> B = A(4.)
  >>> m = get_pure_function(B.forward)
  >>> m.set_objparams([3.])
  >>> m(2)
  6.0
class_docstr_tok: ["Implementation","of","PureFunction","for","torch.nn.Module",".","Examples","--","--","--","--",">",">",">","import","torch",">",">",">","from","deepchem.utils.differentiation_utils","import","get_pure_function",">",">",">","class","A","(","torch.nn.Module",")",":","...","def","__init__","(","self",",","a",")",":","...","super","(",")",".__init__","(",")","...","self.b","=","torch.nn.Parameter","(","torch.tensor","(","a","*","a",")",")","...","def","forward","(","self",",","x",")",":","...","return","self.b","*","x",">",">",">","B","=","A","(","4",".",")",">",">",">","m","=","get_pure_function","(","B.forward",")",">",">",">","m.set_objparams","(","[","3",".","]",")",">",">",">","m","(","2",")","6.0"]
docstr: get the tensors in the torch.nn.Module to be used as params
  
  Returns
  -------
  List
      The initial object parameters
docstr_tok: ["get","the","tensors","in","the","torch.nn.Module","to","be","used","as","params","Returns","--","--","--","-","List","The","initial","object","parameters"]
code: def _get_all_obj_params_init(self) -> List:
      """get the tensors in the torch.nn.Module to be used as params
  
      Returns
      -------
      List
          The initial object parameters
  
      """
      named_params = list(self.obj.named_parameters())
      if len(named_params) == 0:
          paramnames: List[str] = []
          obj_params: List[Union[torch.Tensor, torch.nn.Parameter]] = []
      else:
          paramnames_temp, obj_params_temp = zip(*named_params)
          paramnames = list(paramnames_temp)
          obj_params = list(obj_params_temp)
      self.names = paramnames
      return obj_params
  
imports: import torch
  import inspect
  from typing import Callable, List, Tuple, Union
  from deepchem.utils.attribute_utils import set_attr, del_attr
  from deepchem.utils.differentiation_utils import EditableModule
  from deepchem.utils.misc_utils import Uniquifier
  from contextlib import contextmanager
  from abc import abstractmethod
label_desc: Use image node_id 2 for calling the TorchNNPureFunction obj's underlying member method code with example usage: obj._get_all_obj_params_init() and returns: obj_params