code: def rgb_to_grayscale(input, name=None):
      """
      Convert a RGB image to Grayscale (ITU-R).
  
      Args:
        input: A 3-D (`[H, W, 3]`) or 4-D (`[N, H, W, 3]`) Tensor.
        name: A name for the operation (optional).
  
      Returns:
        A 3-D (`[H, W, 3]`) or 4-D (`[N, H, W, 3]`) Tensor.
      """
      # Note: This rgb_to_grayscale conforms to skimage.color.rgb2gray
      # and is different from tf.image.rgb_to_grayscale
      input = tf.convert_to_tensor(input)
  
      value = tf.image.convert_image_dtype(input, tf.float32)
      coeff = [0.2125, 0.7154, 0.0721]
      value = tf.tensordot(value, coeff, (-1, -1))
      value = tf.expand_dims(value, -1)
      return tf.image.convert_image_dtype(value, input.dtype)
  
imports: import tensorflow
label_desc: Use image node_id 21 for calling a global function with example usage: rgb_to_grayscale(input, name) and returns: tf