code: def image_gradients(img: Tensor) -> Tuple[Tensor, Tensor]:
      """Compute `Gradient Computation of Image`_ of a given image using finite difference.
  
      Args:
          img: An ``(N, C, H, W)`` input tensor where ``C`` is the number of image channels
  
      Return:
          Tuple of ``(dy, dx)`` with each gradient of shape ``[N, C, H, W]``
  
      Raises:
          TypeError:
              If ``img`` is not of the type :class:`~torch.Tensor`.
          RuntimeError:
              If ``img`` is not a 4D tensor.
  
      Example:
          >>> from torchmetrics.functional.image import image_gradients
          >>> image = torch.arange(0, 1*1*5*5, dtype=torch.float32)
          >>> image = torch.reshape(image, (1, 1, 5, 5))
          >>> dy, dx = image_gradients(image)
          >>> dy[0, 0, :, :]
          tensor([[5., 5., 5., 5., 5.],
                  [5., 5., 5., 5., 5.],
                  [5., 5., 5., 5., 5.],
                  [5., 5., 5., 5., 5.],
                  [0., 0., 0., 0., 0.]])
  
      .. note:: The implementation follows the 1-step finite difference method as followed
             by the TF implementation. The values are organized such that the gradient of
             [I(x+1, y)-[I(x, y)]] are at the (x, y) location
  
      """
      _image_gradients_validate(img)
  
      return _compute_image_gradients(img)
  
imports: from typing import Tuple
  import torch
  from torch import Tensor
label_desc: Use image node_id 3 for calling a global function with example usage: image_gradients(img) and returns: _compute_image_gradients