code: def equalize(img: Tensor) -> Tensor:
      _assert_image_tensor(img)
  
      if not (3 <= img.ndim <= 4):
          raise TypeError(
              f"Input image tensor should have 3 or 4 dimensions, but found {img.ndim}"
          )
      if img.dtype != torch.uint8:
          raise TypeError(
              f"Only torch.uint8 image tensors are supported, but found {img.dtype}"
          )
  
      _assert_channels(img, [1, 3])
  
      if img.ndim == 3:
          return _equalize_single_image(img)
  
      return torch.stack([_equalize_single_image(x) for x in img])
  
imports: import warnings
  from typing import List, Optional, Tuple, Union
  import torch
  from torch import Tensor
  from torch.nn.functional import conv2d, grid_sample, interpolate, pad
label_desc: Use image node_id 46 for calling a global function with example usage: equalize(img) and returns: torch, _equalize_single_image