class_docstr: Abstract base class (ABC) for continuous entropy layers
  
  This base class pre-computes integer probability tables based on a prior
  distribution, which can be used across different platforms by a range
  encoder and decoder.
  
  Args:
      coding_rank: Number of innermost dimensions considered a coding unit.
          Each coding unit is compressed to its own bit string. The coding
          units are summed during propagation.
      compressible: If ``True``, the integer probability tables used by the
          ``compress()`` and ``decompress()`` methods will be instantiated.
          If ``False``, these two methods are inaccessible.
      stateless: If ``True``, creates range coding tables as ``Tensor``s.
          This makes the entropy model stateless and the range coding tables
          are expected to be provided manually. If ``compressible`` is
          ``False``, then it is implied ``stateless`` is ``True`` and the
          provided ``stateless`` value is ignored. If ``False``, range coding
          tables are persisted as ``Parameter``s. This allows the entropy
          model to be serialized, so both the range encoder and decoder use
          identical tables when loading the stored model.
      prior: A probability density function fitting the marginal
          distribution of the bottleneck data with additive uniform noise,
          which is shared a priori between the sender and the receiver. For
          best results, the distribution should be flexible enough to have a
          unit-width uniform distribution as a special case, since this is
          the marginal distribution for bottleneck dimensions that are
          constant.
      tail_mass: An approximate probability mass which is range encoded with
          less precision, by using a Golomb-like code.
      prior_dtype: The data type of the prior. Must be provided when
          ``prior`` is omitted.
      prior_shape: The batch shape of the prior, i.e. dimensions which are
          not assumed identically distributed (i.i.d.). Must be provided when
          ``prior`` is omitted.
      range_coder_precision: The precision passed to ``range_encoder`` and
          ``range_decoder``.
      cdfs: If provided, used for range coding rather than the probability
          tables built from ``prior``.
      cdf_sizes: Must be provided alongside ``cdfs``.
      cdf_offsets: Must be provided alongside ``cdfs``.
      maximum_cdf_size: The maximum ``cdf_sizes``. When provided, an empty
          range coding table is created, which can then be restored. Requires
          ``compressible`` to be ``True`` and ``stateless`` to be ``False``.
class_docstr_tok: ["Abstract","base","class","(","ABC",")","for","continuous","entropy","layers","This","base","class","pre-computes","integer","probability","tables","based","on","a","prior","distribution",",","which","can","be","used","across","different","platforms","by","a","range","encoder","and","decoder",".","Args",":","coding_rank",":","Number","of","innermost","dimensions","considered","a","coding","unit",".","Each","coding","unit","is","compressed","to","its","own","bit","string",".","The","coding","units","are","summed","during","propagation",".","compressible",":","If","``","True","``",",","the","integer","probability","tables","used","by","the","``","compress","(",")","``","and","``","decompress","(",")","``","methods","will","be","instantiated",".","If","``","False","``",",","these","two","methods","are","inaccessible",".","stateless",":","If","``","True","``",",","creates","range","coding","tables","as","``","Tensor","``","s",".","This","makes","the","entropy","model","stateless","and","the","range","coding","tables","are","expected","to","be","provided","manually",".","If","``","compressible","``","is","``","False","``",",","then","it","is","implied","``","stateless","``","is","``","True","``","and","the","provided","``","stateless","``","value","is","ignored",".","If","``","False","``",",","range","coding","tables","are","persisted","as","``","Parameter","``","s",".","This","allows","the","entropy","model","to","be","serialized",",","so","both","the","range","encoder","and","decoder","use","identical","tables","when","loading","the","stored","model",".","prior",":","A","probability","density","function","fitting","the","marginal","distribution","of","the","bottleneck","data","with","additive","uniform","noise",",","which","is","shared","a","priori","between","the","sender","and","the","receiver",".","For","best","results",",","the","distribution","should","be","flexible","enough","to","have","a","unit-width","uniform","distribution","as","a","special","case",",","since","this","is","the","marginal","distribution","for","bottleneck","dimensions","that","are","constant",".","tail_mass",":","An","approximate","probability","mass","which","is","range","encoded","with","less","precision",",","by","using","a","Golomb-like","code",".","prior_dtype",":","The","data","type","of","the","prior",".","Must","be","provided","when","``","prior","``","is","omitted",".","prior_shape",":","The","batch","shape","of","the","prior",",","i.e",".","dimensions","which","are","not","assumed","identically","distributed","(","i.i.d.",")",".","Must","be","provided","when","``","prior","``","is","omitted",".","range_coder_precision",":","The","precision","passed","to","``","range_encoder","``","and","``","range_decoder","``",".","cdfs",":","If","provided",",","used","for","range","coding","rather","than","the","probability","tables","built","from","``","prior","``",".","cdf_sizes",":","Must","be","provided","alongside","``","cdfs","``",".","cdf_offsets",":","Must","be","provided","alongside","``","cdfs","``",".","maximum_cdf_size",":","The","maximum","``","cdf_sizes","``",".","When","provided",",","an","empty","range","coding","table","is","created",",","which","can","then","be","restored",".","Requires","``","compressible","``","to","be","``","True","``","and","``","stateless","``","to","be","``","False","``","."]
code: def _validate_cdf_offsets(self):
      offsets = self._cdf_offsets
  
      if offsets.numel() == 0:
          error_message = r"""uninitialized cumulative distribution function
              (CDF) offsets
              """
  
          raise ValueError(error_message)
  
      if len(offsets.size()) != 1:
          error_message = r"""invalid cumulative distribution function (CDF)
              offsets
              """
  
          raise ValueError(error_message)
  
imports: import abc
  from typing import Optional, Tuple, Union
  import torch
  import torch.nn
  from compressai.entropy_models.entropy_models import pmf_to_quantized_cdf
  from torch import IntTensor, Size, Tensor
  from torch.distributions import Distribution
  from torch.nn import Module
  import neuralcompression.functional
  from neuralcompression.distributions import UniformNoise
label_desc: Use image node_id 19 for calling the ContinuousEntropy obj's underlying member method code with example usage: obj._validate_cdf_offsets() without return types