class_docstr: Bijector which applies a composition of bijectors.
  
  Example Use:
  
  ```python
  chain = Chain([Exp(), Softplus()], name="one_plus_exp")
  ```
  
  Results in:
  
  * Forward:
  
    ```python
    exp = Exp()
    softplus = Softplus()
    Chain([exp, softplus]).forward(x)
    = exp.forward(softplus.forward(x))
    = tf.exp(tf.log(1. + tf.exp(x)))
    = 1. + tf.exp(x)
    ```
  
  * Inverse:
  
    ```python
    exp = Exp()
    softplus = Softplus()
    Chain([exp, softplus]).inverse(y)
    = softplus.inverse(exp.inverse(y))
    = tf.log(tf.exp(tf.log(y)) - 1.)
    = tf.log(y - 1.)
    ```
  
  Keyword arguments can be passed to the inner bijectors by utilizing the inner
  bijector names, e.g.:
  
  ```python
  chain = Chain([Bijector1(name='b1'), Bijector2(name='b2')])
  y = chain.forward(x, b1={'arg': 1}, b2={'arg': 2})
  
  # Equivalent to:
  z = Bijector2().forward(x, arg=1)
  y = Bijector1().forward(z, arg=2)
  ```
class_docstr_tok: ["Bijector","which","applies","a","composition","of","bijectors",".","Example","Use",":","``","`","python","chain","=","Chain","(","[","Exp","(",")",",","Softplus","(",")","]",",","name=","''","one_plus_exp","''",")","``","`","Results","in",":","*","Forward",":","``","`","python","exp","=","Exp","(",")","softplus","=","Softplus","(",")","Chain","(","[","exp",",","softplus","]",")",".forward","(","x",")","=","exp.forward","(","softplus.forward","(","x",")",")","=","tf.exp","(","tf.log","(","1",".","+","tf.exp","(","x",")",")",")","=","1",".","+","tf.exp","(","x",")","``","`","*","Inverse",":","``","`","python","exp","=","Exp","(",")","softplus","=","Softplus","(",")","Chain","(","[","exp",",","softplus","]",")",".inverse","(","y",")","=","softplus.inverse","(","exp.inverse","(","y",")",")","=","tf.log","(","tf.exp","(","tf.log","(","y",")",")","-","1",".",")","=","tf.log","(","y","-","1",".",")","``","`","Keyword","arguments","can","be","passed","to","the","inner","bijectors","by","utilizing","the","inner","bijector","names",",","e.g",".",":","``","`","python","chain","=","Chain","(","[","Bijector1","(","name='b1","'",")",",","Bijector2","(","name='b2","'",")","]",")","y","=","chain.forward","(","x",",","b1=","{","'arg","'",":","1","}",",","b2=","{","'arg","'",":","2","}",")","#","Equivalent","to",":","z","=","Bijector2","(",")",".forward","(","x",",","arg=1",")","y","=","Bijector1","(",")",".forward","(","z",",","arg=2",")","``","`"]
docstr: Instantiates `Chain` bijector.
  
  Args:
    bijectors: Python `list` of bijector instances. An empty list makes this
      bijector equivalent to the `Identity` bijector. The bijectors are
      applied in sequence starting from the end of the list.
    validate_args: Python `bool` indicating whether arguments should be
      checked for correctness.
    validate_event_size: Checks that bijectors are not applied to inputs with
      incomplete support (that is, inputs where one or more elements are a
      deterministic transformation of the others). For example, the following
      LDJ would be incorrect:
      `Chain([Scale(), SoftmaxCentered()]).forward_log_det_jacobian([1], [1])`
      The jacobian contribution from `Scale` applies to a 2-dimensional input,
      but the output from `SoftMaxCentered` is a 1-dimensional input embedded
      in a 2-dimensional space. Setting `validate_event_size=True` (default)
      prints warnings in these cases. When `validate_args` is also `True`, the
      warning is promoted to an exception.
    parameters: Locals dict captured by subclass constructor, to be used for
      copy/slice re-instantiation operators.
    name: Python `str`, name given to ops managed by this object. Default:
      E.g., `Chain([Exp(), Softplus()]).name == "chain_of_exp_of_softplus"`.
  
  Raises:
    ValueError: if bijectors have different dtypes.
docstr_tok: ["Instantiates","`","Chain","`","bijector",".","Args",":","bijectors",":","Python","`","list","`","of","bijector","instances",".","An","empty","list","makes","this","bijector","equivalent","to","the","`","Identity","`","bijector",".","The","bijectors","are","applied","in","sequence","starting","from","the","end","of","the","list",".","validate_args",":","Python","`","bool","`","indicating","whether","arguments","should","be","checked","for","correctness",".","validate_event_size",":","Checks","that","bijectors","are","not","applied","to","inputs","with","incomplete","support","(","that","is",",","inputs","where","one","or","more","elements","are","a","deterministic","transformation","of","the","others",")",".","For","example",",","the","following","LDJ","would","be","incorrect",":","`","Chain","(","[","Scale","(",")",",","SoftmaxCentered","(",")","]",")",".forward_log_det_jacobian","(","[","1","]",",","[","1","]",")","`","The","jacobian","contribution","from","`","Scale","`","applies","to","a","2-dimensional","input",",","but","the","output","from","`","SoftMaxCentered","`","is","a","1-dimensional","input","embedded","in","a","2-dimensional","space",".","Setting","`","validate_event_size=True","`","(","default",")","prints","warnings","in","these","cases",".","When","`","validate_args","`","is","also","`","True","`",",","the","warning","is","promoted","to","an","exception",".","parameters",":","Locals","dict","captured","by","subclass","constructor",",","to","be","used","for","copy\/slice","re-instantiation","operators",".","name",":","Python","`","str","`",",","name","given","to","ops","managed","by","this","object",".","Default",":","E.g.",",","`","Chain","(","[","Exp","(",")",",","Softplus","(",")","]",")",".name","==","``","chain_of_exp_of_softplus","''","`",".","Raises",":","ValueError",":","if","bijectors","have","different","dtypes","."]
code: def __init__(
      self,
      bijectors=None,
      validate_args=False,
      validate_event_size=False,
      parameters=None,
      name=None,
  ):
      """Instantiates `Chain` bijector.
  
      Args:
        bijectors: Python `list` of bijector instances. An empty list makes this
          bijector equivalent to the `Identity` bijector. The bijectors are
          applied in sequence starting from the end of the list.
        validate_args: Python `bool` indicating whether arguments should be
          checked for correctness.
        validate_event_size: Checks that bijectors are not applied to inputs with
          incomplete support (that is, inputs where one or more elements are a
          deterministic transformation of the others). For example, the following
          LDJ would be incorrect:
          `Chain([Scale(), SoftmaxCentered()]).forward_log_det_jacobian([1], [1])`
          The jacobian contribution from `Scale` applies to a 2-dimensional input,
          but the output from `SoftMaxCentered` is a 1-dimensional input embedded
          in a 2-dimensional space. Setting `validate_event_size=True` (default)
          prints warnings in these cases. When `validate_args` is also `True`, the
          warning is promoted to an exception.
        parameters: Locals dict captured by subclass constructor, to be used for
          copy/slice re-instantiation operators.
        name: Python `str`, name given to ops managed by this object. Default:
          E.g., `Chain([Exp(), Softplus()]).name == "chain_of_exp_of_softplus"`.
  
      Raises:
        ValueError: if bijectors have different dtypes.
      """
      parameters = dict(locals()) if parameters is None else parameters
  
      if name is None:
          name = (
              "identity"
              if not bijectors
              else "_of_".join(["chain"] + [b.name for b in bijectors])
          )
          name = name.replace("/", "")
  
      # If there are no bijectors, treat this like a single-part Identity.
      forward_min_event_ndims = 0
      inverse_min_event_ndims = 0
      if bijectors:
          forward_min_event_ndims = None  # Inferred by base class.
          inverse_min_event_ndims = None  # Inferred by base class.
  
      with tf.name_scope(name) as name:
          super(_Chain, self).__init__(
              bijectors=bijectors or (),
              validate_args=validate_args,
              validate_event_size=validate_event_size,
              forward_min_event_ndims=forward_min_event_ndims,
              inverse_min_event_ndims=inverse_min_event_ndims,
              parameters=parameters,
              name=name,
          )
  
file_path: probability/tensorflow_probability/python/bijectors/chain.py
imports: import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import bijector
  from tensorflow_probability.python.bijectors import composition
  from tensorflow_probability.python.internal import auto_composite_tensor
  from tensorflow_probability.python.internal import prefer_static
label_desc: Use image node_id 1 to create a new _Chain object from inherited base classes: composition with example: obj = _Chain(bijectors, validate_args, validate_event_size, parameters, name)