code: def testComputeBitsAndNats(self):
      reconstruction_loss = tf.random_uniform(())
      prior_loss = tf.random_uniform(())
      data_dim = tf.random_uniform((), maxval=1000, dtype=tf.int32)
      latent_dim = tf.random_uniform((), maxval=1000, dtype=tf.int32)
      (
          nats_per_dim,
          bits_per_dim,
      ) = latent_layers.compute_nats_and_bits_per_dim(
          data_dim, latent_dim, reconstruction_loss, prior_loss
      )
  
      nats_per_dim_py, bits_per_dim_conv_py = self.evaluate(
          [nats_per_dim, bits_per_dim * tf.log(2.0)]
      )
      self.assertAllClose(nats_per_dim_py, bits_per_dim_conv_py)
  
file_path: tensor2tensor/tensor2tensor/layers/latent_layers_test.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import functools
  from tensor2tensor.layers import common_image_attention
  from tensor2tensor.layers import discretization
  from tensor2tensor.layers import latent_layers
  from tensor2tensor.models import transformer
  from tensor2tensor.utils import test_utils
  import tensorflow.compat.v1
  from tensorflow.compat.v1 import estimator
label_desc: Use image node_id 1 for calling the LatentLayersTest obj's underlying member method code with example usage: obj.testComputeBitsAndNats() without return types