class_docstr: Normalizing flows are widley used to perform generative models.
  This algorithm gives advantages over variational autoencoders (VAE) because
  of ease in sampling by applying invertible transformations
  (Frey, Gadepally, & Ramsundar, 2022).
  
  Example
  --------
  >>> import deepchem as dc
  >>> from deepchem.models.torch_models.layers import Affine
  >>> from deepchem.models.torch_models.normalizing_flows_pytorch import NormalizingFlow
  >>> import torch
  >>> from torch.distributions import MultivariateNormal
  >>> # initialize the transformation layer's parameters
  >>> dim = 2
  >>> samples = 96
  >>> transforms = [Affine(dim)]
  >>> distribution = MultivariateNormal(torch.zeros(dim), torch.eye(dim))
  >>> # initialize normalizing flow model
  >>> model = NormalizingFlow(transforms, distribution, dim)
  >>> # evaluate the log_prob when applying the transformation layers
  >>> input = distribution.sample(torch.Size((samples, dim)))
  >>> len(model.log_prob(input))
  96
  >>> # evaluates the the sampling method and its log_prob
  >>> len(model.sample(samples))
  2
docstr: This method computes the probability of the inputs when
  transformation/transformations are applied.
  
  Parameters
  ----------
  inputs: torch.Tensor
      Tensor used to evaluate the log_prob computation of the learned
      distribution.
      shape: (samples, dim)
  
  Returns
  -------
  log_prob: torch.Tensor
      This tensor contains the value of the log probability computed.
      shape: (samples)
docstr_tok: ["This","method","computes","the","probability","of","the","inputs","when","transformation\/transformations","are","applied",".","Parameters","--","--","--","--","--","inputs",":","torch.Tensor","Tensor","used","to","evaluate","the","log_prob","computation","of","the","learned","distribution",".","shape",":","(","samples",",","dim",")","Returns","--","--","--","-","log_prob",":","torch.Tensor","This","tensor","contains","the","value","of","the","log","probability","computed",".","shape",":","(","samples",")"]
code: def log_prob(self, inputs: torch.Tensor) -> torch.Tensor:
      """This method computes the probability of the inputs when
      transformation/transformations are applied.
  
      Parameters
      ----------
      inputs: torch.Tensor
          Tensor used to evaluate the log_prob computation of the learned
          distribution.
          shape: (samples, dim)
  
      Returns
      -------
      log_prob: torch.Tensor
          This tensor contains the value of the log probability computed.
          shape: (samples)
  
      """
      log_prob = torch.zeros(inputs.shape[0])
      for biject in reversed(self.transforms):
          inputs, inverse_log_det_jacobian = biject.inverse(inputs)
          log_prob += inverse_log_det_jacobian
  
      return log_prob
  
file_path: deepchem/deepchem/models/torch_models/normalizing_flows_pytorch.py
imports: import torch
  from torch import nn
  from typing import Sequence, Tuple
label_desc: Use image node_id 2 for calling the NormalizingFlow obj's underlying member method code with example usage: obj.log_prob(inputs) and returns: log_prob