code: def rotate(
      img: Tensor,
      matrix: List[float],
      interpolation: str = "nearest",
      expand: bool = False,
      fill: Optional[Union[int, float, List[float]]] = None,
  ) -> Tensor:
      _assert_grid_transform_inputs(
          img, matrix, interpolation, fill, ["nearest", "bilinear"]
      )
      w, h = img.shape[-1], img.shape[-2]
      ow, oh = (
          _compute_affine_output_size(matrix, w, h)
          if expand
          else (w, h)
      )
      dtype = (
          img.dtype if torch.is_floating_point(img) else torch.float32
      )
      theta = torch.tensor(
          matrix, dtype=dtype, device=img.device
      ).reshape(1, 2, 3)
      # grid will be generated on the same device as theta and img
      grid = _gen_affine_grid(theta, w=w, h=h, ow=ow, oh=oh)
  
      return _apply_grid_transform(img, grid, interpolation, fill=fill)
  
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 32 for calling a global function with example usage: rotate(img, matrix, interpolation, expand, fill) and returns: _apply_grid_transform