class_docstr: Base class for continuous entropy models.
  
  The basic functionality of this class is to pre-compute integer probability
  tables based on the provided `tfp.distributions.Distribution` object, which
  can then be used reliably across different platforms by the range coder and
  decoder.
class_docstr_tok: ["Base","class","for","continuous","entropy","models",".","The","basic","functionality","of","this","class","is","to","pre-compute","integer","probability","tables","based","on","the","provided","`","tfp.distributions.Distribution","`","object",",","which","can","then","be","used","reliably","across","different","platforms","by","the","range","coder","and","decoder","."]
docstr: Initializes the instance.
  
  Args:
    coding_rank: Integer. Number of innermost dimensions considered a coding
      unit. Each coding unit is compressed to its own bit string, and the
      `__call__()` method sums over each coding unit.
    compression: Boolean. If set to `True`, the range coding tables used by
      `compress()` and `decompress()` will be built on instantiation. If set
      to `False`, these two methods will not be accessible.
    stateless: Boolean. If `False`, range coding tables are created as
      `Variable`s. This allows the entropy model to be serialized using the
      `SavedModel` protocol, so that both the encoder and the decoder use
      identical tables when loading the stored model. If `True`, creates range
      coding tables as `Tensor`s. This makes the entropy model stateless and
      allows it to be constructed within a `tf.function` body, for when the
      range coding tables are provided manually. If `compression=False`, then
      `stateless=True` is implied and the provided value is ignored.
    expected_grads: If True, will use analytical expected gradients during
      backpropagation w.r.t. additive uniform noise.
    tail_mass: Float. Approximate probability mass which is encoded using an
      Elias gamma code embedded into the range coder.
    bottleneck_dtype: `tf.dtypes.DType`. Data type of bottleneck tensor.
      Defaults to `tf.keras.mixed_precision.global_policy().compute_dtype`.
    laplace_tail_mass: Float, or a float-valued tf.Tensor. If positive,
      will augment the prior with a `NoisyLaplace` mixture component for
      training stability. (experimental)
docstr_tok: ["Initializes","the","instance",".","Args",":","coding_rank",":","Integer",".","Number","of","innermost","dimensions","considered","a","coding","unit",".","Each","coding","unit","is","compressed","to","its","own","bit","string",",","and","the","`","__call__","(",")","`","method","sums","over","each","coding","unit",".","compression",":","Boolean",".","If","set","to","`","True","`",",","the","range","coding","tables","used","by","`","compress","(",")","`","and","`","decompress","(",")","`","will","be","built","on","instantiation",".","If","set","to","`","False","`",",","these","two","methods","will","not","be","accessible",".","stateless",":","Boolean",".","If","`","False","`",",","range","coding","tables","are","created","as","`","Variable","`","s",".","This","allows","the","entropy","model","to","be","serialized","using","the","`","SavedModel","`","protocol",",","so","that","both","the","encoder","and","the","decoder","use","identical","tables","when","loading","the","stored","model",".","If","`","True","`",",","creates","range","coding","tables","as","`","Tensor","`","s",".","This","makes","the","entropy","model","stateless","and","allows","it","to","be","constructed","within","a","`","tf.function","`","body",",","for","when","the","range","coding","tables","are","provided","manually",".","If","`","compression=False","`",",","then","`","stateless=True","`","is","implied","and","the","provided","value","is","ignored",".","expected_grads",":","If","True",",","will","use","analytical","expected","gradients","during","backpropagation","w.r.t",".","additive","uniform","noise",".","tail_mass",":","Float",".","Approximate","probability","mass","which","is","encoded","using","an","Elias","gamma","code","embedded","into","the","range","coder",".","bottleneck_dtype",":","`","tf.dtypes.DType","`",".","Data","type","of","bottleneck","tensor",".","Defaults","to","`","tf.keras.mixed_precision.global_policy","(",")",".compute_dtype","`",".","laplace_tail_mass",":","Float",",","or","a","float-valued","tf.Tensor",".","If","positive",",","will","augment","the","prior","with","a","`","NoisyLaplace","`","mixture","component","for","training","stability",".","(","experimental",")"]
code: def __init__(
      self,
      coding_rank=None,
      compression=False,
      stateless=False,
      expected_grads=False,
      tail_mass=2**-8,
      bottleneck_dtype=None,
      laplace_tail_mass=0,
  ):
      """Initializes the instance.
  
      Args:
        coding_rank: Integer. Number of innermost dimensions considered a coding
          unit. Each coding unit is compressed to its own bit string, and the
          `__call__()` method sums over each coding unit.
        compression: Boolean. If set to `True`, the range coding tables used by
          `compress()` and `decompress()` will be built on instantiation. If set
          to `False`, these two methods will not be accessible.
        stateless: Boolean. If `False`, range coding tables are created as
          `Variable`s. This allows the entropy model to be serialized using the
          `SavedModel` protocol, so that both the encoder and the decoder use
          identical tables when loading the stored model. If `True`, creates range
          coding tables as `Tensor`s. This makes the entropy model stateless and
          allows it to be constructed within a `tf.function` body, for when the
          range coding tables are provided manually. If `compression=False`, then
          `stateless=True` is implied and the provided value is ignored.
        expected_grads: If True, will use analytical expected gradients during
          backpropagation w.r.t. additive uniform noise.
        tail_mass: Float. Approximate probability mass which is encoded using an
          Elias gamma code embedded into the range coder.
        bottleneck_dtype: `tf.dtypes.DType`. Data type of bottleneck tensor.
          Defaults to `tf.keras.mixed_precision.global_policy().compute_dtype`.
        laplace_tail_mass: Float, or a float-valued tf.Tensor. If positive,
          will augment the prior with a `NoisyLaplace` mixture component for
          training stability. (experimental)
      """
      super().__init__()
      self._prior = (
          None  # This will be set by subclasses, if appropriate.
      )
      self._coding_rank = int(coding_rank)
      self._compression = bool(compression)
      self._stateless = bool(stateless)
      self._expected_grads = bool(expected_grads)
      self._tail_mass = float(tail_mass)
      if bottleneck_dtype is None:
          bottleneck_dtype = (
              tf.keras.mixed_precision.global_policy().compute_dtype
          )
      if bottleneck_dtype is None:
          bottleneck_dtype = tf.keras.backend.floatx()
      self._bottleneck_dtype = tf.as_dtype(bottleneck_dtype)
      self._laplace_tail_mass = laplace_tail_mass
  
      if self.coding_rank < 0:
          raise ValueError("`coding_rank` must be at least 0.")
      if not 0 < self.tail_mass < 1:
          raise ValueError("`tail_mass` must be between 0 and 1.")
  
imports: import abc
  from absl import logging
  import tensorflow
  from tensorflow_compression.python.distributions import helpers
  from tensorflow_compression.python.distributions import uniform_noise
  from tensorflow_compression.python.ops import gen_ops
label_desc: Use image node_id 1 to create a new ContinuousEntropyModelBase object from inherited base classes: tf with example: obj = ContinuousEntropyModelBase(coding_rank, compression, stateless, expected_grads, tail_mass, bottleneck_dtype, laplace_tail_mass)