code: def test_invalid_input_ndims(
      batch_size=1, height=5, width=5, channels=1
  ):
      """Test whether the module successfully handles invalid number of dimensions of input tensor."""
      image = torch.arange(
          0, batch_size * height * width * channels, dtype=torch.float32
      )
      image = torch.reshape(image, (height, width))
  
      with pytest.raises(RuntimeError):
          image_gradients(image)
  
imports: import pytest
  import torch
  from torch import Tensor
  from torchmetrics.functional import image_gradients
label_desc: Use image node_id 2 for calling a global function with example usage: test_invalid_input_ndims(batch_size, height, width, channels) without return types