def METHOD_NAME(self, image, transformation=None, **kwargs):
    grayscale = tf.image.rgb_to_grayscale(image)
    if self.output_channels == 1:
        return grayscale
    elif self.output_channels == 3:
        return tf.image.grayscale_to_rgb(grayscale)
    else:
        raise ValueError("Unsupported value for `output_channels`.")