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: Sets up this entropy model for using the range coder.
  
  This is done by storing `cdf` and `cdf_offset` in `tf.Variable`s
  (`stateless=False`) or `tf.Tensor`s (`stateless=True`) as attributes of this
  object, or creating the variables as placeholders if `cdf_shapes` is
  provided.
  
  The reason for pre-computing the tables is that they must not be
  re-generated independently on the sending and receiving side, since small
  numerical discrepancies between both sides can occur in this process. If the
  tables differ slightly, this in turn would very likely cause catastrophic
  error propagation during range decoding. For a more in-depth discussion of
  this, see:
  
  > "Integer Networks for Data Compression with Latent-Variable Models"<br />
  > J. Ballé, N. Johnston, D. Minnen<br />
  > https://openreview.net/forum?id=S1zz2i0cY7
  
  Args:
    cdf: CDF table for range coder.
    cdf_offset: CDF offset table for range coder.
    cdf_shapes: Iterable of integers, the shapes of `cdf` and `cdf_offset`.
      Mutually exclusive with the other two arguments. If provided, creates
      placeholder values for them.
docstr_tok: ["Sets","up","this","entropy","model","for","using","the","range","coder",".","This","is","done","by","storing","`","cdf","`","and","`","cdf_offset","`","in","`","tf.Variable","`","s","(","`","stateless=False","`",")","or","`","tf.Tensor","`","s","(","`","stateless=True","`",")","as","attributes","of","this","object",",","or","creating","the","variables","as","placeholders","if","`","cdf_shapes","`","is","provided",".","The","reason","for","pre-computing","the","tables","is","that","they","must","not","be","re-generated","independently","on","the","sending","and","receiving","side",",","since","small","numerical","discrepancies","between","both","sides","can","occur","in","this","process",".","If","the","tables","differ","slightly",",","this","in","turn","would","very","likely","cause","catastrophic","error","propagation","during","range","decoding",".","For","a","more","in-depth","discussion","of","this",",","see",":",">","``","Integer","Networks","for","Data","Compression","with","Latent-Variable","Models","''","<","br","\/",">",">","J.","Ball\u00e9",",","N.","Johnston",",","D.","Minnen","<","br","\/",">",">","https",":","\/\/openreview.net\/forum","?","id=S1zz2i0cY7","Args",":","cdf",":","CDF","table","for","range","coder",".","cdf_offset",":","CDF","offset","table","for","range","coder",".","cdf_shapes",":","Iterable","of","integers",",","the","shapes","of","`","cdf","`","and","`","cdf_offset","`",".","Mutually","exclusive","with","the","other","two","arguments",".","If","provided",",","creates","placeholder","values","for","them","."]
code: def _init_compression(self, cdf, cdf_offset, cdf_shapes):
      """Sets up this entropy model for using the range coder.
  
      This is done by storing `cdf` and `cdf_offset` in `tf.Variable`s
      (`stateless=False`) or `tf.Tensor`s (`stateless=True`) as attributes of this
      object, or creating the variables as placeholders if `cdf_shapes` is
      provided.
  
      The reason for pre-computing the tables is that they must not be
      re-generated independently on the sending and receiving side, since small
      numerical discrepancies between both sides can occur in this process. If the
      tables differ slightly, this in turn would very likely cause catastrophic
      error propagation during range decoding. For a more in-depth discussion of
      this, see:
  
      > "Integer Networks for Data Compression with Latent-Variable Models"<br />
      > J. Ballé, N. Johnston, D. Minnen<br />
      > https://openreview.net/forum?id=S1zz2i0cY7
  
      Args:
        cdf: CDF table for range coder.
        cdf_offset: CDF offset table for range coder.
        cdf_shapes: Iterable of integers, the shapes of `cdf` and `cdf_offset`.
          Mutually exclusive with the other two arguments. If provided, creates
          placeholder values for them.
      """
      if (
          not (cdf is None)
          == (cdf_offset is None)
          == (cdf_shapes is not None)
      ):
          raise ValueError(
              "Either both `cdf` and `cdf_offset`, or `cdf_shapes` must be "
              "provided."
          )
      if cdf_shapes is not None:
          if self.stateless:
              raise ValueError(
                  "With `stateless=True`, can't provide `cdf_shapes`."
              )
          cdf_shapes = tuple(map(int, cdf_shapes))
          if len(cdf_shapes) != 2:
              raise ValueError("`cdf_shapes` must have two elements.")
          cdf = tf.zeros(cdf_shapes[:1], dtype=tf.int32)
          cdf_offset = tf.zeros(cdf_shapes[1:], dtype=tf.int32)
      if self.stateless:
          self._cdf = tf.convert_to_tensor(
              cdf, dtype=tf.int32, name="cdf"
          )
          self._cdf_offset = tf.convert_to_tensor(
              cdf_offset, dtype=tf.int32, name="cdf_offset"
          )
      else:
          self._cdf = tf.Variable(
              cdf,
              dtype=tf.int32,
              trainable=False,
              name="cdf",
              validate_shape=False,
              shape=[None],
          )
          self._cdf_offset = tf.Variable(
              cdf_offset,
              dtype=tf.int32,
              trainable=False,
              name="cdf_offset",
              validate_shape=False,
              shape=[None],
          )
  
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 15 for calling the ContinuousEntropyModelBase obj's underlying member method code with example usage: obj._init_compression(cdf, cdf_offset, cdf_shapes) without return types