class_docstr: Lossless compression for Herarchical latent variable models.
  
  Based on the Craystack (https://github.com/j-towns/craystack)
  implementation of Bits-Back coding.
  
  Args:
      model: The hierarchical latent variable model.
      data_shape: The shape [batch-size, channels, height, width]
          of the data and each latent.
      latent_prec: Coding precision.
      prior_prec: Precision for the discretization.
      obs_prec: Precision for the observation codec.
      data_prec: Precision of the discrete data.
      initial_len: Length of the random initial bitstring.
      data_min: Minimum value of the data to be fed into the model.
      data_max: Maximum value of the data to be fed into the model.
      clip_stdd: Minimum value for the stdd of the observation codec.
      track: Whether to track the message sizes at each step.
class_docstr_tok: ["Lossless","compression","for","Herarchical","latent","variable","models",".","Based","on","the","Craystack","(","https",":","\/\/github.com\/j-towns\/craystack",")","implementation","of","Bits-Back","coding",".","Args",":","model",":","The","hierarchical","latent","variable","model",".","data_shape",":","The","shape","[","batch-size",",","channels",",","height",",","width","]","of","the","data","and","each","latent",".","latent_prec",":","Coding","precision",".","prior_prec",":","Precision","for","the","discretization",".","obs_prec",":","Precision","for","the","observation","codec",".","data_prec",":","Precision","of","the","discrete","data",".","initial_len",":","Length","of","the","random","initial","bitstring",".","data_min",":","Minimum","value","of","the","data","to","be","fed","into","the","model",".","data_max",":","Maximum","value","of","the","data","to","be","fed","into","the","model",".","clip_stdd",":","Minimum","value","for","the","stdd","of","the","observation","codec",".","track",":","Whether","to","track","the","message","sizes","at","each","step","."]
docstr: Output various bit-rates per dimension.
  
  Returns:
      A namedtuple containing the number of encoded samples and the
      total/used/effective bits per dimension used for encoding
      the samples. If `self.track`, also returns the bits per
      dimension used in the pop/push of every diffusion step.
docstr_tok: ["Output","various","bit-rates","per","dimension",".","Returns",":","A","namedtuple","containing","the","number","of","encoded","samples","and","the","total\/used\/effective","bits","per","dimension","used","for","encoding","the","samples",".","If","`","self.track","`",",","also","returns","the","bits","per","dimension","used","in","the","pop\/push","of","every","diffusion","step","."]
code: def statistics(self) -> CodecStats:
      """
      Output various bit-rates per dimension.
  
      Returns:
          A namedtuple containing the number of encoded samples and the
          total/used/effective bits per dimension used for encoding
          the samples. If `self.track`, also returns the bits per
          dimension used in the pop/push of every diffusion step.
      """
      message_bytes = self.flat_message.nbytes
      samples = self.data_count * self.data_shape[0]
      rate_total = self._bytes_to_bpd(message_bytes)
      rate_used = self._bytes_to_bpd(
          message_bytes - self.initial_bytes + self.extra_bytes
      )
      rate_effective = self._bytes_to_bpd(
          message_bytes - self.initial_bytes
      )
      rate_effective_push = (
          self._bytes_to_bpd(self.push_bytes) if self.track else None
      )
      rate_effective_pop = (
          self._bytes_to_bpd(self.pop_bytes) if self.track else None
      )
      return CodecStats(
          samples=samples,
          rate_total=rate_total,
          rate_used=rate_used,
          rate_effective=rate_effective,
          rate_effective_push=rate_effective_push,
          rate_effective_pop=rate_effective_pop,
      )
  
imports: from abc import ABC, abstractmethod
  from typing import List, NamedTuple, Optional, Tuple, Union, overload
  import craystack
  import numpy
  import torch
  from craystack import codecs
  from craystack.bb_ans import BBANS
  from improved_diffusion.gaussian_diffusion import GaussianDiffusion
label_desc: Use image node_id 18 for calling the BitsBackCodec obj's underlying member method code with example usage: obj.statistics() and returns: CodecStats