code: def rotate(
      img: Tensor,
      angle: float,
      interpolation: InterpolationMode = InterpolationMode.NEAREST,
      expand: bool = False,
      center: Optional[List[int]] = None,
      fill: Optional[List[float]] = None,
  ) -> Tensor:
      """Rotate the image by angle.
      If the image is torch Tensor, it is expected
      to have [..., H, W] shape, where ... means an arbitrary number of leading dimensions.
  
      Args:
          img (PIL Image or Tensor): image to be rotated.
          angle (number): rotation angle value in degrees, counter-clockwise.
          interpolation (InterpolationMode): Desired interpolation enum defined by
              :class:`torchvision.transforms.InterpolationMode`. Default is ``InterpolationMode.NEAREST``.
              If input is Tensor, only ``InterpolationMode.NEAREST``, ``InterpolationMode.BILINEAR`` are supported.
              The corresponding Pillow integer constants, e.g. ``PIL.Image.BILINEAR`` are accepted as well.
          expand (bool, optional): Optional expansion flag.
              If true, expands the output image to make it large enough to hold the entire rotated image.
              If false or omitted, make the output image the same size as the input image.
              Note that the expand flag assumes rotation around the center and no translation.
          center (sequence, optional): Optional center of rotation. Origin is the upper left corner.
              Default is the center of the image.
          fill (sequence or number, optional): Pixel fill value for the area outside the transformed
              image. If given a number, the value is used for all bands respectively.
  
              .. note::
                  In torchscript mode single int/float value is not supported, please use a sequence
                  of length 1: ``[value, ]``.
      Returns:
          PIL Image or Tensor: Rotated image.
  
      .. _filters: https://pillow.readthedocs.io/en/latest/handbook/concepts.html#filters
  
      """
      if not torch.jit.is_scripting() and not torch.jit.is_tracing():
          _log_api_usage_once(rotate)
  
      if isinstance(interpolation, int):
          interpolation = _interpolation_modes_from_int(interpolation)
      elif not isinstance(interpolation, InterpolationMode):
          raise TypeError(
              "Argument interpolation should be a InterpolationMode or a corresponding Pillow integer constant"
          )
  
      if not isinstance(angle, (int, float)):
          raise TypeError("Argument angle should be int or float")
  
      if center is not None and not isinstance(center, (list, tuple)):
          raise TypeError("Argument center should be a sequence")
  
      if not isinstance(img, torch.Tensor):
          pil_interpolation = pil_modes_mapping[interpolation]
          return F_pil.rotate(
              img,
              angle=angle,
              interpolation=pil_interpolation,
              expand=expand,
              center=center,
              fill=fill,
          )
  
      center_f = [0.0, 0.0]
      if center is not None:
          _, height, width = get_dimensions(img)
          # Center values should be in pixel coordinates but translated such that (0, 0) corresponds to image center.
          center_f = [
              1.0 * (c - s * 0.5)
              for c, s in zip(center, [width, height])
          ]
  
      # due to current incoherence of rotation angle direction between affine and rotate implementations
      # we need to set -angle.
      matrix = _get_inverse_affine_matrix(
          center_f, -angle, [0.0, 0.0], 1.0, [0.0, 0.0]
      )
      return F_t.rotate(
          img,
          matrix=matrix,
          interpolation=interpolation.value,
          expand=expand,
          fill=fill,
      )
  
imports: import math
  import numbers
  import sys
  import warnings
  from enum import Enum
  from typing import Any, List, Optional, Tuple, Union
  import numpy
  import torch
  from PIL import Image
  from torch import Tensor
  from ..utils import _log_api_usage_once
  from .None import _functional_pil, _functional_tensor
label_desc: Use image node_id 30 for calling a global function with example usage: rotate(img, angle, interpolation, expand, center, fill) and returns: F_t, F_pil