code: def transform_to_normalized_grayscale(tensor):
      """
      Transform tensor over RGB axis to grayscale.
  
      Args:
          tensor (tf.Tensor): 4D-Tensor with shape (batch_size, H, W, 3)
  
      Returns:
          tf.Tensor: 4D-Tensor of grayscale tensor, with shape (batch_size, H, W, 1)
      """
      grayscale_tensor = tf.reduce_sum(tensor, axis=-1)
  
      normalized_tensor = tf.cast(
          255 * tf.image.per_image_standardization(grayscale_tensor),
          tf.uint8,
      )
  
      return normalized_tensor
  
imports: import numpy
  import tensorflow
label_desc: Use image node_id 2 for calling a global function with example usage: transform_to_normalized_grayscale(tensor) and returns: normalized_tensor