code: def frame_to_latents(frame, hparams):
      """Encode frames to latents."""
      # Preprocess
      frame = preprocess_frame(frame)
  
      # Encode [X_t] to [z^1_t, z^2_t .. z^l_t]
      glow_vals = glow_ops.encoder_decoder(
          "codec", frame, hparams, eps=None, reverse=False
      )
      z_top, _, level_eps, _, _ = glow_vals
      return z_top, level_eps
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  from absl import flags
  import numpy
  from six.moves import zip
  from tensor2tensor.bin import t2t_trainer
  from tensor2tensor.data_generators import image_utils
  from tensor2tensor.layers import common_layers
  from tensor2tensor.layers import common_video
  from tensor2tensor.models.research import glow_ops
  from tensor2tensor.utils import contrib
  from tensor2tensor.utils import decoding
  from tensor2tensor.utils import trainer_lib
  import tensorflow.compat.v1
  from tensorflow.compat.v1 import estimator
label_desc: Use image node_id 3 for calling a global function with example usage: frame_to_latents(frame, hparams) and returns: z_top,  level_eps