code: def test_decode_img_as_tensor(mock_image_stream):
      img = decode_img_as_tensor(mock_image_stream)
  
      assert isinstance(img, tf.Tensor)
      assert img.dtype == tf.float32
      assert img.shape == (900, 1200, 3)
  
      img = decode_img_as_tensor(mock_image_stream, dtype=tf.float16)
      assert img.dtype == tf.float16
      img = decode_img_as_tensor(mock_image_stream, dtype=tf.uint8)
      assert img.dtype == tf.uint8
  
      with pytest.raises(ValueError):
          decode_img_as_tensor(mock_image_stream, dtype=tf.float64)
  
imports: import numpy
  import pytest
  import tensorflow
  from doctr.io import decode_img_as_tensor, read_img_as_tensor, tensor_from_numpy
label_desc: Use image node_id 2 for calling a global function with example usage: test_decode_img_as_tensor(mock_image_stream) without return types