class_docstr: Distribution over callable atoms.
  
  This can be thought of as a `tfd.VectorDeterministic` over a point in a
  0-dimensional space, where the singular event happens to be callable.
  
  #### Example
  
  ```python
  dist = Lambda(tf.square)
  layer = layer_dist.sample(seed=tfp.random.sanitize_seed(0))
  y = layer(x)  # Same as tf.square(x)
  ```
class_docstr_tok: ["Distribution","over","callable","atoms",".","This","can","be","thought","of","as","a","`","tfd.VectorDeterministic","`","over","a","point","in","a","0-dimensional","space",",","where","the","singular","event","happens","to","be","callable",".","#","#","#","#","Example","``","`","python","dist","=","Lambda","(","tf.square",")","layer","=","layer_dist.sample","(","seed=tfp.random.sanitize_seed","(","0",")",")","y","=","layer","(","x",")","#","Same","as","tf.square","(","x",")","``","`"]
docstr: Construct the `Lambda` distribution.
  
  Args:
    fn: Callable.
    dtype: Dtype of the zero-sized dummy tensor used to convey batch
      information.
    name: Name to use for the ops defined by this distribution.
docstr_tok: ["Construct","the","`","Lambda","`","distribution",".","Args",":","fn",":","Callable",".","dtype",":","Dtype","of","the","zero-sized","dummy","tensor","used","to","convey","batch","information",".","name",":","Name","to","use","for","the","ops","defined","by","this","distribution","."]
code: def __init__(self, fn, dtype=tf.float32, name="Lambda"):
      """Construct the `Lambda` distribution.
  
      Args:
        fn: Callable.
        dtype: Dtype of the zero-sized dummy tensor used to convey batch
          information.
        name: Name to use for the ops defined by this distribution.
      """
      parameters = dict(locals())
  
      def model():
          # The primary utility of assocating a Tensor with this distribution is to
          # propagate the sample shape in situations like `log_prob(sample(shape))`.
          yield self.Root(
              deterministic.VectorDeterministic(
                  tf.zeros([0], dtype), name="dummy_value"
              )
          )
  
      super().__init__(
          model,
          name=name,
          sample_dtype=make_lambda_layer_class(fn)(dummy_value=None),
      )
      self._parameters = parameters
  
imports: import collections
  import functools
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import deterministic
  from tensorflow_probability.python.distributions import joint_distribution_coroutine
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.distributions import sample
  from tensorflow_probability.python.internal import vectorization_util
label_desc: Use image node_id 1 to create a new Lambda object from inherited base classes: joint_distribution_coroutine with example: obj = Lambda(fn, dtype, name)