code: def _mean_image_subtraction(image, means):
      """Subtracts the given means from each image channel.
  
      For example:
        means = [123.68, 116.779, 103.939]
        image = _mean_image_subtraction(image, means)
  
      Note that the rank of `image` must be known.
  
      Args:
        image: a tensor of size [height, width, C].
        means: a C-vector of values to subtract from each channel.
  
      Returns:
        the centered image.
  
      Raises:
        ValueError: If the rank of `image` is unknown, if `image` has a rank other
          than three or if the number of channels in `image` doesn't match the
          number of values in `means`.
      """
      if image.get_shape().ndims != 3:
          raise ValueError("Input must be of size [height, width, C>0]")
      num_channels = image.get_shape().as_list()[-1]
      if len(means) != num_channels:
          raise ValueError(
              "len(means) must match the number of channels"
          )
  
      channels = tf.split(
          axis=2, num_or_size_splits=num_channels, value=image
      )
      for i in range(num_channels):
          channels[i] -= means[i]
      return tf.concat(axis=2, values=channels)
  
file_path: tensor2tensor/tensor2tensor/data_generators/vqa_utils.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import tensorflow.compat.v1
  from tensorflow.compat.v1 import estimator
  from tensorflow.python.ops import control_flow_ops
label_desc: Use image node_id 6 for calling a global function with example usage: _mean_image_subtraction(image, means) and returns: tf