code: def test_togray():
      transfo = T.ToGray()
      r = tf.fill([8, 32, 32, 1], 0.2)
      g = tf.fill([8, 32, 32, 1], 0.6)
      b = tf.fill([8, 32, 32, 1], 0.7)
      input_t = tf.cast(tf.concat([r, g, b], axis=-1), dtype=tf.float32)
      out = transfo(input_t)
  
      assert tf.reduce_all(out <= 0.51)
      assert tf.reduce_all(out >= 0.49)
  
      # FP16
      input_t = tf.cast(tf.concat([r, g, b], axis=-1), dtype=tf.float16)
      out = transfo(input_t)
      assert out.dtype == tf.float16
  
imports: import math
  import numpy
  import pytest
  import tensorflow
  from doctr import transforms
  from doctr.transforms.functional import crop_detection, rotate_sample
label_desc: Use image node_id 5 for calling a global function with example usage: test_togray() without return types