code: def test_latent_dist_encoder(
      self, encoder="conv_lstm", skip=True, dropout=0.0, noise=0.1
  ):
      with tf.Graph().as_default():
          rng = np.random.RandomState(0)
          # Initialize x, latent, state.
          x_rand = rng.randn(12, 32, 32, 16).astype(np.float32)
          latent_rand = rng.randn(12, 32, 32, 16).astype(np.float32)
          state_rand = rng.randn(12, 32, 32, 256).astype(np.float32)
          x_t = tf.convert_to_tensor(x_rand)
          latent_t = tf.convert_to_tensor(latent_rand)
          state_t = tf.convert_to_tensor(state_rand)
          if encoder in ["conv_net", "conv3d_net"]:
              latent_t = [latent_t, latent_t]
          init_state = tf.nn.rnn_cell.LSTMStateTuple(state_t, state_t)
          hparams = self.get_glow_hparams()
          hparams.latent_dist_encoder = encoder
          hparams.latent_skip = skip
          hparams.latent_encoder_width = 256
          hparams.latent_dropout = dropout
          hparams.latent_noise = noise
  
          with arg_scope([glow_ops.get_dropout], init=False):
              prior_dist, new_state = glow_ops.compute_prior(
                  "prior",
                  x_t,
                  latent=latent_t,
                  hparams=hparams,
                  state=init_state,
                  condition=True,
              )
          with tf.Session() as sess:
              sess.run(tf.global_variables_initializer())
              # Test initialization:
              # Scale is 1.0
              # If skip is set to True, then mean equals the input latent.
              # If skip, is set to False, then the mean is zero.
              ops = [prior_dist.loc, prior_dist.scale]
              mean, scale = sess.run(ops)
  
              if skip:
                  self.assertTrue(np.allclose(latent_rand - mean, 0.0))
              else:
                  self.assertTrue(np.allclose(mean, 0.0))
              self.assertTrue(np.allclose(scale, 1.0))
  
              # State update.
              if encoder == "conv_lstm":
                  state_diff = sess.run(new_state.h - init_state.h)
                  self.assertFalse(np.allclose(state_diff, 0.0))
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import tempfile
  from absl.testing import parameterized
  import numpy
  from six.moves import range
  from six.moves import zip
  from tensor2tensor.models.research import glow
  from tensor2tensor.models.research import glow_ops
  from tensor2tensor.utils import contrib
  from tensor2tensor.utils import hparam
  import tensorflow.compat.v1
  from tensorflow.compat.v1 import estimator
label_desc: Use image node_id 17 for calling the GlowOpsTest obj's underlying member method code with example usage: obj.test_latent_dist_encoder(encoder, skip, dropout, noise) without return types