code: def adjust_hue(img: Tensor, hue_factor: float) -> Tensor:
      if not (-0.5 <= hue_factor <= 0.5):
          raise ValueError(
              f"hue_factor ({hue_factor}) is not in [-0.5, 0.5]."
          )
  
      if not (isinstance(img, torch.Tensor)):
          raise TypeError("Input img should be Tensor image")
  
      _assert_image_tensor(img)
  
      _assert_channels(img, [1, 3])
      if get_dimensions(img)[0] == 1:  # Match PIL behaviour
          return img
  
      orig_dtype = img.dtype
      img = convert_image_dtype(img, torch.float32)
  
      img = _rgb2hsv(img)
      h, s, v = img.unbind(dim=-3)
      h = (h + hue_factor) % 1.0
      img = torch.stack((h, s, v), dim=-3)
      img_hue_adj = _hsv2rgb(img)
  
      return convert_image_dtype(img_hue_adj, orig_dtype)
  
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 15 for calling a global function with example usage: adjust_hue(img, hue_factor) and returns: convert_image_dtype, img