class_docstr: Utils for testing next_frame_glow.
class_docstr_tok: ["Utils","for","testing","next_frame_glow","."]
code: def RunModel(
      self,
      model,
      train_op,
      hparams,
      features,
      num_frames,
      model_path=None,
  ):
      exp_num_frames = num_frames + int(hparams.cond_first_frame)
      if hparams.gen_mode == "conditional":
          self.assertLen(model.all_top_latents, exp_num_frames)
          self.assertLen(model.all_level_latents, exp_num_frames)
  
      with tf.Session() as session:
          if model_path is not None:
              saver = tf.train.Saver()
  
          session.run(tf.global_variables_initializer())
  
          # Run initialization.
          init_op = tf.get_collection("glow_init_op")
          session.run(init_op)
  
          loss, top_conds = session.run(
              [train_op["training"], model._all_conds]
          )  # pylint: disable=protected-access
          self.checkAllConds(top_conds, num_frames, hparams)
  
          if model_path is not None:
              saver.save(session, model_path)
  
          # Check that one forward-propagation does not NaN, i.e
          # initialization etc works as expected.
          self.assertTrue(loss > 0.0 and loss < 10.0)
  
file_path: tensor2tensor/tensor2tensor/models/video/nfg_test_utils.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import tempfile
  import numpy
  from tensor2tensor.data_generators import video_generated
  from tensor2tensor.models.video import next_frame_glow
  from tensor2tensor.utils import registry
  import tensorflow.compat.v1
  from tensorflow.compat.v1 import estimator
label_desc: Use image node_id 3 for calling the NextFrameGlowTest obj's underlying member method code with example usage: obj.RunModel(model, train_op, hparams, features, num_frames, model_path) without return types