class_docstr: Glow generative model.
  
  Reference: https://arxiv.org/abs/1807.03039
class_docstr_tok: ["Glow","generative","model",".","Reference",":","https",":","\/\/arxiv.org\/abs\/1807.03039"]
docstr: Objective in terms of bits-per-pixel.
  
  Args:
    features: dict of tensors with "features" and "targets" keys.
    init: Whether or not to run data-dependent init.
  Returns:
    objective: float, bits-per-pixel.
docstr_tok: ["Objective","in","terms","of","bits-per-pixel",".","Args",":","features",":","dict","of","tensors","with","``","features","''","and","``","targets","''","keys",".","init",":","Whether","or","not","to","run","data-dependent","init",".","Returns",":","objective",":","float",",","bits-per-pixel","."]
code: def objective_tower(self, features, init=True):
      """Objective in terms of bits-per-pixel.
  
      Args:
        features: dict of tensors with "features" and "targets" keys.
        init: Whether or not to run data-dependent init.
      Returns:
        objective: float, bits-per-pixel.
      """
      x = features["inputs"]
  
      # Scale x such that the pixels lie in-between -0.5 and.0.5
      x = self.preprocess(x)
      x, objective = glow_ops.uniform_binning_correction(x)
  
      # The arg_scope call ensures that the actnorm parameters are set such that
      # the per-channel output activations have zero mean and unit variance
      # ONLY during the first step. After that the parameters are learned
      # through optimisation.
      ops = [
          glow_ops.get_variable_ddi,
          glow_ops.actnorm,
          glow_ops.get_dropout,
      ]
      with arg_scope(ops, init=init):
          encoder = glow_ops.encoder_decoder
  
          self.z, encoder_objective, self.eps, _, _ = encoder(
              "codec", x, self.hparams, eps=None, reverse=False
          )
          objective += encoder_objective
  
          self.z_top_shape = common_layers.shape_list(self.z)
          prior_dist = self.top_prior()
          prior_objective = tf.reduce_sum(
              prior_dist.log_prob(self.z), axis=[1, 2, 3]
          )
          self.z_sample = prior_dist.sample()
          objective += prior_objective
  
      # bits per pixel
      _, h, w, c = common_layers.shape_list(x)
      objective = -objective / (np.log(2) * h * w * c)
      return objective
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  from tensor2tensor.layers import common_hparams
  from tensor2tensor.layers import common_layers
  from tensor2tensor.models.research import glow_init_hook
  from tensor2tensor.models.research import glow_ops
  from tensor2tensor.utils import contrib
  from tensor2tensor.utils import registry
  from tensor2tensor.utils import t2t_model
  import tensorflow.compat.v1
  from tensorflow.compat.v1 import estimator
label_desc: Use image node_id 10 for calling the Glow obj's underlying member method code with example usage: obj.objective_tower(features, init) and returns: objective