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",")"]
docstr: Update state with predictions and targets.
docstr_tok: ["Update","state","with","predictions","and","targets","."]
code: def update(self, preds: Tensor, target: Tensor) -> None:
      """Update state with predictions and targets."""
      preds, target = _uqi_update(preds, target)
      if self.reduction is None or self.reduction == "none":
          self.preds.append(preds)
          self.target.append(target)
      else:
          uqi_score = _uqi_compute(
              preds,
              target,
              self.kernel_size,
              self.sigma,
              reduction="sum",
          )
          self.sum_uqi += uqi_score
          ps = preds.shape
          self.numel += (
              ps[0]
              * ps[1]
              * (ps[2] - self.kernel_size[0] + 1)
              * (ps[3] - self.kernel_size[1] + 1)
          )
  
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 2 for calling the UniversalImageQualityIndex obj's underlying member method code with example usage: obj.update(preds, target) without return types