class_docstr: MSCoCo at multiple resolutions.
code: def preprocess_example(self, example, mode, hparams):
      image = example["inputs"]
      # Get resize method. Include a default if not specified, or if it's not in
      # TensorFlow's collection of pre-implemented resize methods.
      resize_method = getattr(hparams, "resize_method", "BICUBIC")
      resize_method = getattr(
          tf.image.ResizeMethod, resize_method, resize_method
      )
  
      highest_res = hparams.resolutions[-1]
      if resize_method == "DILATED":
          # Resize image so that dilated subsampling is properly divisible.
          scaled_image = image_utils.resize_by_area(image, highest_res)
          scaled_images = image_utils.make_multiscale_dilated(
              scaled_image,
              hparams.resolutions,
              num_channels=self.num_channels,
          )
      else:
          scaled_images = image_utils.make_multiscale(
              image,
              hparams.resolutions,
              resize_method=resize_method,
              num_channels=self.num_channels,
          )
  
      # Pack tuple of scaled images into one tensor. We do this by enforcing the
      # columns to match for every resolution.
      example["inputs"] = tf.concat(
          [
              tf.reshape(
                  scaled_image,
                  [
                      res**2 // highest_res,
                      highest_res,
                      self.num_channels,
                  ],
              )
              for scaled_image, res in zip(
                  scaled_images, hparams.resolutions
              )
          ],
          axis=0,
      )
      return example
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import io
  import json
  import os
  import random
  import zipfile
  from tensor2tensor.data_generators import generator_utils
  from tensor2tensor.data_generators import image_utils
  from tensor2tensor.data_generators import imagenet
  from tensor2tensor.data_generators import problem
  from tensor2tensor.data_generators import text_encoder
  from tensor2tensor.data_generators import translate_ende
  from tensor2tensor.utils import registry
  import tensorflow.compat.v1
label_desc: Use image node_id 2 for calling the ImageTextMsCocoMultiResolution obj's underlying member method code with example usage: obj.preprocess_example(example, mode, hparams) and returns: example