class_docstr: Base class for normalizing flow.
  
  The purpose of a normalizing flow is to map a simple distribution (that is
  easy to sample from and evaluate probability densities for) to a more
  complex distribution that is learned from data. The base distribution
  p(x) is transformed by the associated normalizing flow y=g(x) to model the
  distribution p(y).
  
  Normalizing flows combine the advantages of autoregressive models
  (which provide likelihood estimation but do not learn features) and
  variational autoencoders (which learn feature representations but
  do not provide marginal likelihoods).
class_docstr_tok: ["Base","class","for","normalizing","flow",".","The","purpose","of","a","normalizing","flow","is","to","map","a","simple","distribution","(","that","is","easy","to","sample","from","and","evaluate","probability","densities","for",")","to","a","more","complex","distribution","that","is","learned","from","data",".","The","base","distribution","p","(","x",")","is","transformed","by","the","associated","normalizing","flow","y=g","(","x",")","to","model","the","distribution","p","(","y",")",".","Normalizing","flows","combine","the","advantages","of","autoregressive","models","(","which","provide","likelihood","estimation","but","do","not","learn","features",")","and","variational","autoencoders","(","which","learn","feature","representations","but","do","not","provide","marginal","likelihoods",")","."]
docstr: Create a new NormalizingFlow.
  
  Parameters
  ----------
  base_distribution: tfd.Distribution
      Probability distribution to be transformed.
      Typically an N dimensional multivariate Gaussian.
  flow_layers: Sequence[tfb.Bijector]
      An iterable of bijectors that comprise the flow.
  **kwargs
docstr_tok: ["Create","a","new","NormalizingFlow",".","Parameters","--","--","--","--","--","base_distribution",":","tfd.Distribution","Probability","distribution","to","be","transformed",".","Typically","an","N","dimensional","multivariate","Gaussian",".","flow_layers",":","Sequence","[","tfb.Bijector","]","An","iterable","of","bijectors","that","comprise","the","flow",".","*","*","kwargs"]
code: def __init__(
      self, base_distribution, flow_layers: Sequence, **kwargs
  ) -> None:
      """Create a new NormalizingFlow.
  
      Parameters
      ----------
      base_distribution: tfd.Distribution
          Probability distribution to be transformed.
          Typically an N dimensional multivariate Gaussian.
      flow_layers: Sequence[tfb.Bijector]
          An iterable of bijectors that comprise the flow.
      **kwargs
  
      """
  
      try:
          import tensorflow_probability as tfp
  
          tfd = tfp.distributions
          tfb = tfp.bijectors
      except ModuleNotFoundError:
          raise ImportError(
              "This class requires tensorflow-probability to be installed."
          )
  
      self.base_distribution = base_distribution
      self.flow_layers = flow_layers
  
      # Chain of flows is also a normalizing flow
      bijector = tfb.Chain(list(reversed(self.flow_layers)))
  
      # An instance of tfd.TransformedDistribution
      self.flow = tfd.TransformedDistribution(
          distribution=self.base_distribution, bijector=bijector
      )
  
      super(NormalizingFlow, self).__init__(**kwargs)
  
imports: import logging
  from typing import List, Optional, Sequence, Callable
  import tensorflow
  from deepchem.models.keras_model import KerasModel
  from deepchem.utils.typing import OneOrMany
  from deepchem.utils.data_utils import load_from_disk, save_to_disk
label_desc: Use image node_id 1 to create a new NormalizingFlow object from inherited base classes: tf.keras.models with example: obj = NormalizingFlow(base_distribution, flow_layers)