code: def invert(img: Tensor) -> Tensor:
      _assert_image_tensor(img)
  
      if img.ndim < 3:
          raise TypeError(
              f"Input image tensor should have at least 3 dimensions, but found {img.ndim}"
          )
  
      _assert_channels(img, [1, 3])
  
      return _max_value(img.dtype) - 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 38 for calling a global function with example usage: invert(img) and returns: unknown