class_docstr: Compute Universal Image Quality Index (UniversalImageQualityIndex_).
  
  As input to ``forward`` and ``update`` the metric accepts the following input
  
  - ``preds`` (:class:`~torch.Tensor`): Predictions from model of shape ``(N,C,H,W)``
  - ``target`` (:class:`~torch.Tensor`): Ground truth values of shape ``(N,C,H,W)``
  
  As output of `forward` and `compute` the metric returns the following output
  
  - ``uiqi`` (:class:`~torch.Tensor`): if ``reduction!='none'`` returns float scalar tensor with average UIQI value
    over sample else returns tensor of shape ``(N,)`` with UIQI values per sample
  
  Args:
      kernel_size: size of the gaussian kernel
      sigma: Standard deviation of the gaussian kernel
      reduction: a method to reduce metric score over labels.
  
          - ``'elementwise_mean'``: takes the mean (default)
          - ``'sum'``: takes the sum
          - ``'none'`` or ``None``: no reduction will be applied
  
      kwargs: Additional keyword arguments, see :ref:`Metric kwargs` for more info.
  
  Return:
      Tensor with UniversalImageQualityIndex score
  
  Example:
      >>> import torch
      >>> from torchmetrics.image import UniversalImageQualityIndex
      >>> preds = torch.rand([16, 1, 16, 16])
      >>> target = preds * 0.75
      >>> uqi = UniversalImageQualityIndex()
      >>> uqi(preds, target)
      tensor(0.9216)
class_docstr_tok: ["Compute","Universal","Image","Quality","Index","(","UniversalImageQualityIndex_",")",".","As","input","to","``","forward","``","and","``","update","``","the","metric","accepts","the","following","input","-","``","preds","``","(",":","class",":","`","~torch.Tensor","`",")",":","Predictions","from","model","of","shape","``","(","N",",","C",",","H",",","W",")","``","-","``","target","``","(",":","class",":","`","~torch.Tensor","`",")",":","Ground","truth","values","of","shape","``","(","N",",","C",",","H",",","W",")","``","As","output","of","`","forward","`","and","`","compute","`","the","metric","returns","the","following","output","-","``","uiqi","``","(",":","class",":","`","~torch.Tensor","`",")",":","if","``","reduction","!","='none","'","``","returns","float","scalar","tensor","with","average","UIQI","value","over","sample","else","returns","tensor","of","shape","``","(","N",",",")","``","with","UIQI","values","per","sample","Args",":","kernel_size",":","size","of","the","gaussian","kernel","sigma",":","Standard","deviation","of","the","gaussian","kernel","reduction",":","a","method","to","reduce","metric","score","over","labels",".","-","``","'elementwise_mean","'","``",":","takes","the","mean","(","default",")","-","``","'sum","'","``",":","takes","the","sum","-","``","'none","'","``","or","``","None","``",":","no","reduction","will","be","applied","kwargs",":","Additional","keyword","arguments",",","see",":","ref",":","`","Metric","kwargs","`","for","more","info",".","Return",":","Tensor","with","UniversalImageQualityIndex","score","Example",":",">",">",">","import","torch",">",">",">","from","torchmetrics.image","import","UniversalImageQualityIndex",">",">",">","preds","=","torch.rand","(","[","16",",","1",",","16",",","16","]",")",">",">",">","target","=","preds","*","0.75",">",">",">","uqi","=","UniversalImageQualityIndex","(",")",">",">",">","uqi","(","preds",",","target",")","tensor","(","0.9216",")"]
code: def __init__(
      self,
      kernel_size: Sequence[int] = (11, 11),
      sigma: Sequence[float] = (1.5, 1.5),
      reduction: Literal[
          "elementwise_mean", "sum", "none", None
      ] = "elementwise_mean",
      **kwargs: Any,
  ) -> None:
      super().__init__(**kwargs)
      if reduction not in ("elementwise_mean", "sum", "none", None):
          raise ValueError(
              f"The `reduction` {reduction} is not valid. Valid options are `elementwise_mean`, `sum`, `none`, None."
          )
      if reduction is None or reduction == "none":
          rank_zero_warn(
              "Metric `UniversalImageQualityIndex` will save all targets and predictions in the buffer when using"
              "`reduction=None` or `reduction='none'. For large datasets, this may lead to a large memory footprint."
          )
          self.add_state("preds", default=[], dist_reduce_fx="cat")
          self.add_state("target", default=[], dist_reduce_fx="cat")
      else:
          self.add_state("sum_uqi", tensor(0.0), dist_reduce_fx="sum")
          self.add_state("numel", tensor(0), dist_reduce_fx="sum")
      self.kernel_size = kernel_size
      self.sigma = sigma
      self.reduction = reduction
  
file_path: torchmetrics/src/torchmetrics/image/uqi.py
imports: from typing import Any, List, Optional, Sequence, Union
  from torch import Tensor, tensor
  from typing_extensions import Literal
  from torchmetrics.functional.image.uqi import _uqi_compute, _uqi_update
  from torchmetrics.metric import Metric
  from torchmetrics.utilities import rank_zero_warn
  from torchmetrics.utilities.data import dim_zero_cat
  from torchmetrics.utilities.imports import _MATPLOTLIB_AVAILABLE
  from torchmetrics.utilities.plot import _AX_TYPE, _PLOT_OUT_TYPE
label_desc: Use image node_id 1 to create a new UniversalImageQualityIndex object from inherited base classes: Metric with example: obj = UniversalImageQualityIndex(kernel_size, sigma, reduction)