code: def testConvertPredictionsToImageSummaries(self):
      # Initialize predictions.
      rng = np.random.RandomState(0)
      x = rng.randint(0, 255, (32, 32, 3))
      predictions = [[{"outputs": x, "inputs": x}] * 50]
  
      decode_hparams = decoding.decode_hparams()
      # should return 20 summaries of images, 10 outputs and 10 inputs if
      # display_decoded_images is set to True.
      for display, summaries_length in zip([True, False], [20, 0]):
          decode_hparams.display_decoded_images = display
          decode_hooks = decoding.DecodeHookArgs(
              estimator=None,
              problem=None,
              output_dirs=None,
              hparams=decode_hparams,
              decode_hparams=decode_hparams,
              predictions=predictions,
          )
          summaries = (
              image_utils.convert_predictions_to_image_summaries(
                  decode_hooks
              )
          )
          self.assertEqual(len(summaries), summaries_length)
          if summaries:
              self.assertIsInstance(summaries[0], tf.Summary.Value)
  
file_path: tensor2tensor/tensor2tensor/data_generators/image_utils_test.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  from tensor2tensor.data_generators import image_utils
  from tensor2tensor.utils import decoding
  import tensorflow.compat.v1
label_desc: Use image node_id 11 for calling the ImageTest obj's underlying member method code with example usage: obj.testConvertPredictionsToImageSummaries() without return types