code: def adjust_gamma(
      img: Tensor, gamma: float, gain: float = 1
  ) -> Tensor:
      r"""Perform gamma correction on an image.
  
      Also known as Power Law Transform. Intensities in RGB mode are adjusted
      based on the following equation:
  
      .. math::
          I_{\text{out}} = 255 \times \text{gain} \times \left(\frac{I_{\text{in}}}{255}\right)^{\gamma}
  
      See `Gamma Correction`_ for more details.
  
      .. _Gamma Correction: https://en.wikipedia.org/wiki/Gamma_correction
  
      Args:
          img (PIL Image or Tensor): PIL Image to be adjusted.
              If img is torch Tensor, it is expected to be in [..., 1 or 3, H, W] format,
              where ... means it can have an arbitrary number of leading dimensions.
              If img is PIL Image, modes with transparency (alpha channel) are not supported.
          gamma (float): Non negative real number, same as :math:`\gamma` in the equation.
              gamma larger than 1 make the shadows darker,
              while gamma smaller than 1 make dark regions lighter.
          gain (float): The constant multiplier.
      Returns:
          PIL Image or Tensor: Gamma correction adjusted image.
      """
      if not torch.jit.is_scripting() and not torch.jit.is_tracing():
          _log_api_usage_once(adjust_gamma)
      if not isinstance(img, torch.Tensor):
          return F_pil.adjust_gamma(img, gamma, gain)
  
      return F_t.adjust_gamma(img, gamma, gain)
  
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 28 for calling a global function with example usage: adjust_gamma(img, gamma, gain) and returns: F_t, F_pil