code: def test_glow(self):
      with tf.Graph().as_default():
          hparams = glow.glow_hparams()
          hparams.depth = 15
          hparams.n_levels = 2
          hparams.init_batch_size = 256
          hparams.batch_size = 1
          hparams.data_dir = ""
          cifar_problem = problems.problem(
              "image_cifar10_plain_random_shift"
          )
          hparams.problem = cifar_problem
          model = glow.Glow(hparams, tf_estimator.ModeKeys.TRAIN)
          train_dataset = cifar_problem.dataset(MODES.TRAIN)
          one_shot = train_dataset.make_one_shot_iterator()
          x_batch, y_batch = self.batch(one_shot)
          features = {"inputs": x_batch, "targets": y_batch}
          _, obj_dict = model.body(features)
          objective = obj_dict["training"]
          with tf.Session() as sess:
              sess.run(tf.global_variables_initializer())
  
              # Run initialization.
              init_op = tf.get_collection("glow_init_op")
              sess.run(init_op)
  
              # Run forward pass.
              obj_np = sess.run(objective)
              mean_obj = np.mean(obj_np)
  
              # Check that one forward-propagation does not NaN, i.e
              # initialization etc works as expected.
              self.assertTrue(mean_obj > 0 and mean_obj < 10.0)
  
file_path: tensor2tensor/tensor2tensor/models/research/glow_test.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import tempfile
  import numpy
  from six.moves import range
  from tensor2tensor import problems
  from tensor2tensor.data_generators import cifar
  from tensor2tensor.models.research import glow
  from tensor2tensor.utils import registry
  import tensorflow.compat.v1
  from tensorflow.compat.v1 import estimator
label_desc: Use image node_id 2 for calling the GlowModelTest obj's underlying member method code with example usage: obj.test_glow() without return types