code: def test_num_channels_in_image():
      image_2d = torch.randint(0, 1, (10, 10))
      image_3d = torch.randint(0, 1, (3, 10, 10))
      assert num_channels_in_image(image_2d) == 1
      assert num_channels_in_image(image_3d) == 3
  
      with pytest.raises(ValueError):
          num_channels_in_image(torch.rand(5))
          num_channels_in_image(None)
  
file_path: ludwig/tests/ludwig/utils/test_image_utils.py
imports: from typing import Callable
  import pytest
  import torch
  import torchvision.transforms.functional
  from ludwig.utils.image_utils import crop, crop_or_pad, grayscale, is_image_score, num_channels_in_image, pad, read_image_as_tif, resize_image, ResizeChannels
label_desc: Use image node_id 6 for calling a global function with example usage: test_num_channels_in_image() without return types