class_docstr: Class that provides function to separate/combine tensors and nontensors
  parameters.
  
  Examples
  --------
  >>> import torch
  >>> from deepchem.utils.pytorch_utils import TensorNonTensorSeparator
  >>> a = torch.tensor([1.,2,3])
  >>> b = 4.
  >>> c = torch.tensor([5.,6,7], requires_grad=True)
  >>> params = [a, b, c]
  >>> separator = TensorNonTensorSeparator(params)
  >>> tensor_params = separator.get_tensor_params()
  >>> tensor_params
  [tensor([5., 6., 7.], requires_grad=True)]
class_docstr_tok: ["Class","that","provides","function","to","separate\/combine","tensors","and","nontensors","parameters",".","Examples","--","--","--","--",">",">",">","import","torch",">",">",">","from","deepchem.utils.pytorch_utils","import","TensorNonTensorSeparator",">",">",">","a","=","torch.tensor","(","[","1.,2,3","]",")",">",">",">","b","=","4",".",">",">",">","c","=","torch.tensor","(","[","5.,6,7","]",",","requires_grad=True",")",">",">",">","params","=","[","a",",","b",",","c","]",">",">",">","separator","=","TensorNonTensorSeparator","(","params",")",">",">",">","tensor_params","=","separator.get_tensor_params","(",")",">",">",">","tensor_params","[","tensor","(","[","5.",",","6.",",","7",".","]",",","requires_grad=True",")","]"]
docstr: Reconstruct the parameters from tensor and nontensor parameters.
  
  Parameters
  ----------
  tensor_params: List[torch.Tensor]
      A list of tensor parameters.
  nontensor_params: Optional[List]
      A list of nontensor parameters. If None, the original nontensor
      parameters will be used.
  
  Returns
  -------
  List
      A list of parameters.
docstr_tok: ["Reconstruct","the","parameters","from","tensor","and","nontensor","parameters",".","Parameters","--","--","--","--","--","tensor_params",":","List","[","torch.Tensor","]","A","list","of","tensor","parameters",".","nontensor_params",":","Optional","[","List","]","A","list","of","nontensor","parameters",".","If","None",",","the","original","nontensor","parameters","will","be","used",".","Returns","--","--","--","-","List","A","list","of","parameters","."]
code: def reconstruct_params(self, tensor_params, nontensor_params=None):
      """Reconstruct the parameters from tensor and nontensor parameters.
  
      Parameters
      ----------
      tensor_params: List[torch.Tensor]
          A list of tensor parameters.
      nontensor_params: Optional[List]
          A list of nontensor parameters. If None, the original nontensor
          parameters will be used.
  
      Returns
      -------
      List
          A list of parameters.
  
      """
      if nontensor_params is None:
          nontensor_params = self.nontensor_params
      if len(tensor_params) + len(nontensor_params) != self.nparams:
          raise ValueError(
              "The total length of tensor and nontensor params "
              "do not match with the expected length: %d instead of %d"
              % (
                  len(tensor_params) + len(nontensor_params),
                  self.nparams,
              )
          )
      if self.alltensors:
          return tensor_params
  
      params = [None for _ in range(self.nparams)]
      for nidx, p in zip(self.nontensor_idxs, nontensor_params):
          params[nidx] = p
      for idx, p in zip(self.tensor_idxs, tensor_params):
          params[idx] = p
      return params
  
file_path: deepchem/deepchem/utils/pytorch_utils.py
imports: import scipy
  import torch
  from typing import Callable, Union, List, Generator, Tuple
label_desc: Use image node_id 5 for calling the TensorNonTensorSeparator obj's underlying member method code with example usage: obj.reconstruct_params(tensor_params, nontensor_params) and returns: params, tensor_params