code: def testImagetransformer(self, net, hparams):
      batch_size = 3
      size = 7
      vocab_size = 256
      p_hparams = problem_hparams.test_problem_hparams(
          vocab_size, vocab_size, hparams
      )
      inputs = np.random.randint(vocab_size, size=(batch_size, 1, 1, 1))
      targets = np.random.randint(
          vocab_size, size=(batch_size, size, size, 3)
      )
      with self.test_session() as session:
          features = {
              "inputs": tf.constant(inputs, dtype=tf.int32),
              "targets": tf.constant(targets, dtype=tf.int32),
              "target_space_id": tf.constant(1, dtype=tf.int32),
          }
          model = net(hparams, tf_estimator.ModeKeys.TRAIN, p_hparams)
          logits, _ = model(features)
          session.run(tf.global_variables_initializer())
          res = session.run(logits)
      if (
          hparams.likelihood
          == common_image_attention.DistributionType.CAT
      ):
          expected = (batch_size, size, size, 3, vocab_size)
      else:
          expected = (batch_size, size, size, hparams.num_mixtures * 10)
      self.assertEqual(res.shape, expected)
  
file_path: tensor2tensor/tensor2tensor/models/image_transformer_test.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from absl.testing import parameterized
  import numpy
  from tensor2tensor.data_generators import problem_hparams
  from tensor2tensor.layers import common_image_attention
  from tensor2tensor.models import image_transformer
  import tensorflow.compat.v1
  from tensorflow.compat.v1 import estimator
label_desc: Use image node_id 1 for calling the ImagetransformerTest obj's underlying member method code with example usage: obj.testImagetransformer(net, hparams) without return types