class_docstr: Continuous Bernoulli distribution.
  
  This distribution is parameterized by `probs`, a (batch of) parameters
  taking values in `(0, 1)`. Note that, unlike in the Bernoulli case, `probs`
  does not correspond to a probability, but the same name is used due to the
  similarity with the Bernoulli.
  
  #### Mathematical Details
  
  The continuous Bernoulli is a distribution over the interval `[0, 1]`,
  parameterized by `probs` in `(0, 1)`.
  
  The probability density function (pdf) is,
  
  ```none
  pdf(x; probs) = probs**x * (1 - probs)**(1 - x) * C(probs)
  C(probs) = (2 * atanh(1 - 2 * probs) / (1 - 2 * probs) if probs != 0.5
              else 2.)
  ```
  
  While the normalizing constant `C(probs)` is a continuous function of `probs`
  (even at `probs = 0.5`), computing it at values close to 0.5 can result in
  numerical instabilities due to 0/0 errors. A Taylor approximation of
  `C(probs)` is thus used for values of `probs`
  in a small interval around 0.5.
  
  NOTE: Unlike the Bernoulli, numerical instabilities can happen for `probs`
  very close to 0 or 1. Current implementation allows any value in `(0, 1)`,
  but this could be changed to `(1e-6, 1-1e-6)` to avoid these issues.
  
  #### References
  
  [1] Loaiza-Ganem G and Cunningham JP. The continuous Bernoulli: fixing a
      pervasive error in variational autoencoders. NeurIPS2019.
      https://arxiv.org/abs/1907.06845
docstr: Construct Bernoulli distributions.
  
  Args:
    logits: An N-D `Tensor`. Each entry in the `Tensor` parameterizes
     an independent continuous Bernoulli distribution with parameter
     sigmoid(logits). Only one of `logits` or `probs` should be passed
     in. Note that this does not correspond to the log-odds as in the
     Bernoulli case.
    probs: An N-D `Tensor` representing the parameter of a continuous
     Bernoulli. Each entry in the `Tensor` parameterizes an independent
     continuous Bernoulli distribution. Only one of `logits` or `probs`
     should be passed in. Note that this also does not correspond to a
     probability as in the Bernoulli case.
    dtype: The type of the event samples. Default: `float32`.
     validate_args: Python `bool`, default `False`. When `True`
     distribution parameters are checked for validity despite possibly
     degrading runtime performance. When `False` invalid inputs may
     silently render incorrect outputs.
    allow_nan_stats: Python `bool`, default `True`. When `True`,
      statistics (e.g., mean, mode, variance) use the value "`NaN`" to
      indicate the result is undefined. When `False`, an exception is
      raised if one or more of the statistic's batch members are
      undefined.
    name: Python `str` name prefixed to Ops created by this class.
  
  Raises:
    ValueError: If probs and logits are passed, or if neither are passed.
docstr_tok: ["Construct","Bernoulli","distributions",".","Args",":","logits",":","An","N-D","`","Tensor","`",".","Each","entry","in","the","`","Tensor","`","parameterizes","an","independent","continuous","Bernoulli","distribution","with","parameter","sigmoid","(","logits",")",".","Only","one","of","`","logits","`","or","`","probs","`","should","be","passed","in",".","Note","that","this","does","not","correspond","to","the","log-odds","as","in","the","Bernoulli","case",".","probs",":","An","N-D","`","Tensor","`","representing","the","parameter","of","a","continuous","Bernoulli",".","Each","entry","in","the","`","Tensor","`","parameterizes","an","independent","continuous","Bernoulli","distribution",".","Only","one","of","`","logits","`","or","`","probs","`","should","be","passed","in",".","Note","that","this","also","does","not","correspond","to","a","probability","as","in","the","Bernoulli","case",".","dtype",":","The","type","of","the","event","samples",".","Default",":","`","float32","`",".","validate_args",":","Python","`","bool","`",",","default","`","False","`",".","When","`","True","`","distribution","parameters","are","checked","for","validity","despite","possibly","degrading","runtime","performance",".","When","`","False","`","invalid","inputs","may","silently","render","incorrect","outputs",".","allow_nan_stats",":","Python","`","bool","`",",","default","`","True","`",".","When","`","True","`",",","statistics","(","e.g.",",","mean",",","mode",",","variance",")","use","the","value","``","`","NaN","`","``","to","indicate","the","result","is","undefined",".","When","`","False","`",",","an","exception","is","raised","if","one","or","more","of","the","statistic","'s","batch","members","are","undefined",".","name",":","Python","`","str","`","name","prefixed","to","Ops","created","by","this","class",".","Raises",":","ValueError",":","If","probs","and","logits","are","passed",",","or","if","neither","are","passed","."]
code: def __init__(
      self,
      logits=None,
      probs=None,
      dtype=tf.float32,
      validate_args=False,
      allow_nan_stats=True,
      name="ContinuousBernoulli",
  ):
      """Construct Bernoulli distributions.
  
      Args:
        logits: An N-D `Tensor`. Each entry in the `Tensor` parameterizes
         an independent continuous Bernoulli distribution with parameter
         sigmoid(logits). Only one of `logits` or `probs` should be passed
         in. Note that this does not correspond to the log-odds as in the
         Bernoulli case.
        probs: An N-D `Tensor` representing the parameter of a continuous
         Bernoulli. Each entry in the `Tensor` parameterizes an independent
         continuous Bernoulli distribution. Only one of `logits` or `probs`
         should be passed in. Note that this also does not correspond to a
         probability as in the Bernoulli case.
        dtype: The type of the event samples. Default: `float32`.
         validate_args: Python `bool`, default `False`. When `True`
         distribution parameters are checked for validity despite possibly
         degrading runtime performance. When `False` invalid inputs may
         silently render incorrect outputs.
        allow_nan_stats: Python `bool`, default `True`. When `True`,
          statistics (e.g., mean, mode, variance) use the value "`NaN`" to
          indicate the result is undefined. When `False`, an exception is
          raised if one or more of the statistic's batch members are
          undefined.
        name: Python `str` name prefixed to Ops created by this class.
  
      Raises:
        ValueError: If probs and logits are passed, or if neither are passed.
      """
      parameters = dict(locals())
      if (probs is None) == (logits is None):
          raise ValueError(
              "Must pass `probs` or `logits`, but not both."
          )
      with tf.name_scope(name) as name:
          self._probs = tensor_util.convert_nonref_to_tensor(
              probs, dtype_hint=tf.float32, name="probs"
          )
          self._logits = tensor_util.convert_nonref_to_tensor(
              logits, dtype_hint=tf.float32, name="logits"
          )
      super(ContinuousBernoulli, self).__init__(
          dtype=dtype,
          reparameterization_type=reparameterization.FULLY_REPARAMETERIZED,
          validate_args=validate_args,
          allow_nan_stats=allow_nan_stats,
          parameters=parameters,
          name=name,
      )
  
imports: import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import sigmoid
  from tensorflow_probability.python.distributions import distribution
  from tensorflow_probability.python.distributions import kullback_leibler
  from tensorflow_probability.python.internal import assert_util
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import parameter_properties
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import reparameterization
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.internal import tensor_util
  from tensorflow_probability.python.math import generic
label_desc: Use image node_id 1 to create a new ContinuousBernoulli object from inherited base classes: distribution with example: obj = ContinuousBernoulli(logits, probs, dtype, validate_args, allow_nan_stats, name)