class_docstr: Factorized prior to code a discrete tensor.
class_docstr_tok: ["Factorized","prior","to","code","a","discrete","tensor","."]
docstr: Apply this layer to code `latents`.
  
  Args:
    latents: Tensor of latent values to code.
    image_shape: The [height, width] of a reference frame.
    mode: The training, evaluation or validation mode of the model.
  
  Returns:
    A FactorizedPriorInfo tuple
docstr_tok: ["Apply","this","layer","to","code","`","latents","`",".","Args",":","latents",":","Tensor","of","latent","values","to","code",".","image_shape",":","The","[","height",",","width","]","of","a","reference","frame",".","mode",":","The","training",",","evaluation","or","validation","mode","of","the","model",".","Returns",":","A","FactorizedPriorInfo","tuple"]
code: def call(
      self, latents, image_shape, mode: ModelMode
  ) -> FactorizedPriorInfo:
      """Apply this layer to code `latents`.
  
      Args:
        latents: Tensor of latent values to code.
        image_shape: The [height, width] of a reference frame.
        mode: The training, evaluation or validation mode of the model.
  
      Returns:
        A FactorizedPriorInfo tuple
      """
      training = mode == ModelMode.TRAINING
      validation = mode == ModelMode.VALIDATION
      latent_shape = tf.shape(latents)[1:-1]
  
      with tf.name_scope("factorized_entropy_model"):
          noisy, quantized, _, nbpp, _, qbpp = estimate_entropy(
              self._entropy_model, latents, spatial_shape=image_shape
          )
  
          compressed = None
          if training:
              latents_decoded = noisy
          elif validation:
              latents_decoded = quantized
          else:
              compressed = self._entropy_model.compress(latents)
  
              # Decompress using the spatial shape tensor and get tensor coming out of
              # range decoder.
              num_channels = latents.shape[-1].value
              latents_decoded = self._entropy_model.decompress(
                  compressed,
                  shape=tf.concat([latent_shape, [num_channels]], 0),
              )
  
          return FactorizedPriorInfo(
              decoded=latents_decoded,
              latent_shape=latent_shape,
              total_nbpp=nbpp,
              total_qbpp=qbpp,
              bitstring=compressed,
          )
  
imports: import collections
  from compare_gan.architectures import abstract_arch
  from compare_gan.architectures import arch_ops
  import numpy
  import tensorflow.compat.v1
  import tensorflow_compression
  from hific.helpers import ModelMode
label_desc: Use image node_id 5 for calling the FactorizedPriorLayer obj's underlying member method code with example usage: obj.call(latents, image_shape, mode) and returns: FactorizedPriorInfo