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 class considers a transformation, or a composition of transformations
  functions (layers), between a base distribution and a target distribution.
  
  Parameters
  ----------
  transform: Sequence
      Bijective transformation/transformations which are considered the layers
      of a Normalizing Flow model.
  base_distribution: torch.Tensor
      Probability distribution to initialize the algorithm. The Multivariate Normal
      distribution is mainly used for this parameter.
  dim: int
      Value of the Nth dimension of the dataset.
docstr_tok: ["This","class","considers","a","transformation",",","or","a","composition","of","transformations","functions","(","layers",")",",","between","a","base","distribution","and","a","target","distribution",".","Parameters","--","--","--","--","--","transform",":","Sequence","Bijective","transformation\/transformations","which","are","considered","the","layers","of","a","Normalizing","Flow","model",".","base_distribution",":","torch.Tensor","Probability","distribution","to","initialize","the","algorithm",".","The","Multivariate","Normal","distribution","is","mainly","used","for","this","parameter",".","dim",":","int","Value","of","the","Nth","dimension","of","the","dataset","."]
code: def __init__(
      self, transform: Sequence, base_distribution, dim: int
  ) -> None:
      """This class considers a transformation, or a composition of transformations
      functions (layers), between a base distribution and a target distribution.
  
      Parameters
      ----------
      transform: Sequence
          Bijective transformation/transformations which are considered the layers
          of a Normalizing Flow model.
      base_distribution: torch.Tensor
          Probability distribution to initialize the algorithm. The Multivariate Normal
          distribution is mainly used for this parameter.
      dim: int
          Value of the Nth dimension of the dataset.
  
      """
      super().__init__()
      self.dim = dim
      self.transforms = nn.ModuleList(transform)
      self.base_distribution = base_distribution
  
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 1 to create a new NormalizingFlow object from inherited base classes: nn with example: obj = NormalizingFlow(transform, base_distribution, dim)