code: def test_tensor_from_numpy(mock_image_stream):
      with pytest.raises(ValueError):
          tensor_from_numpy(np.zeros((256, 256, 3)), torch.int64)
  
      out = tensor_from_numpy(np.zeros((256, 256, 3), dtype=np.uint8))
  
      assert isinstance(out, torch.Tensor)
      assert out.dtype == torch.float32
      assert out.shape == (3, 256, 256)
  
      out = tensor_from_numpy(
          np.zeros((256, 256, 3), dtype=np.uint8), dtype=torch.float16
      )
      assert out.dtype == torch.float16
      out = tensor_from_numpy(
          np.zeros((256, 256, 3), dtype=np.uint8), dtype=torch.uint8
      )
      assert out.dtype == torch.uint8
  
imports: import numpy
  import pytest
  import torch
  from doctr.io import decode_img_as_tensor, read_img_as_tensor, tensor_from_numpy
label_desc: Use image node_id 3 for calling a global function with example usage: test_tensor_from_numpy(mock_image_stream) without return types