class_docstr: Computes Structural Similarity Index Measure
  
  - ``update`` must receive output of the form ``(y_pred, y)``. They have to be of the same type.
      Valid :class:`torch.dtype` are the following:
      - on CPU: `torch.float32`, `torch.float64`.
      - on CUDA: `torch.float16`, `torch.bfloat16`, `torch.float32`, `torch.float64`.
  
  Args:
      data_range: Range of the image. Typically, ``1.0`` or ``255``.
      kernel_size: Size of the kernel. Default: (11, 11)
      sigma: Standard deviation of the gaussian kernel.
          Argument is used if ``gaussian=True``. Default: (1.5, 1.5)
      k1: Parameter of SSIM. Default: 0.01
      k2: Parameter of SSIM. Default: 0.03
      gaussian: ``True`` to use gaussian kernel, ``False`` to use uniform kernel
      output_transform: A callable that is used to transform the
          :class:`~ignite.engine.engine.Engine`'s ``process_function``'s output into the
          form expected by the metric.
      device: specifies which device updates are accumulated on. Setting the metric's
          device to be the same as your ``update`` arguments ensures the ``update`` method is non-blocking. By
          default, CPU.
  
  Examples:
      To use with ``Engine`` and ``process_function``, simply attach the metric instance to the engine.
      The output of the engine's ``process_function`` needs to be in the format of
      ``(y_pred, y)`` or ``{'y_pred': y_pred, 'y': y, ...}``. If not, ``output_tranform`` can be added
      to the metric to transform the output into the form expected by the metric.
  
      ``y_pred`` and ``y`` can be un-normalized or normalized image tensors. Depending on that, the user might need
      to adjust ``data_range``. ``y_pred`` and ``y`` should have the same shape.
  
      For more information on how metric works with :class:`~ignite.engine.engine.Engine`, visit :ref:`attach-engine`.
  
      .. include:: defaults.rst
          :start-after: :orphan:
  
      .. testcode::
  
          metric = SSIM(data_range=1.0)
          metric.attach(default_evaluator, 'ssim')
          preds = torch.rand([4, 3, 16, 16])
          target = preds * 0.75
          state = default_evaluator.run([[preds, target]])
          print(state.metrics['ssim'])
  
      .. testoutput::
  
          0.9218971...
  
  .. versionadded:: 0.4.2
class_docstr_tok: ["Computes","Structural","Similarity","Index","Measure","-","``","update","``","must","receive","output","of","the","form","``","(","y_pred",",","y",")","``",".","They","have","to","be","of","the","same","type",".","Valid",":","class",":","`","torch.dtype","`","are","the","following",":","-","on","CPU",":","`","torch.float32","`",",","`","torch.float64","`",".","-","on","CUDA",":","`","torch.float16","`",",","`","torch.bfloat16","`",",","`","torch.float32","`",",","`","torch.float64","`",".","Args",":","data_range",":","Range","of","the","image",".","Typically",",","``","1.0","``","or","``","255","``",".","kernel_size",":","Size","of","the","kernel",".","Default",":","(","11",",","11",")","sigma",":","Standard","deviation","of","the","gaussian","kernel",".","Argument","is","used","if","``","gaussian=True","``",".","Default",":","(","1.5",",","1.5",")","k1",":","Parameter","of","SSIM",".","Default",":","0.01","k2",":","Parameter","of","SSIM",".","Default",":","0.03","gaussian",":","``","True","``","to","use","gaussian","kernel",",","``","False","``","to","use","uniform","kernel","output_transform",":","A","callable","that","is","used","to","transform","the",":","class",":","`","~ignite.engine.engine.Engine","`","'s","``","process_function","``","'s","output","into","the","form","expected","by","the","metric",".","device",":","specifies","which","device","updates","are","accumulated","on",".","Setting","the","metric's","device","to","be","the","same","as","your","``","update","``","arguments","ensures","the","``","update","``","method","is","non-blocking",".","By","default",",","CPU",".","Examples",":","To","use","with","``","Engine","``","and","``","process_function","``",",","simply","attach","the","metric","instance","to","the","engine",".","The","output","of","the","engine","'s","``","process_function","``","needs","to","be","in","the","format","of","``","(","y_pred",",","y",")","``","or","``","{","'y_pred","'",":","y_pred",",","'","y","'",":","y",",","...","}","``",".","If","not",",","``","output_tranform","``","can","be","added","to","the","metric","to","transform","the","output","into","the","form","expected","by","the","metric",".","``","y_pred","``","and","``","y","``","can","be","un-normalized","or","normalized","image","tensors",".","Depending","on","that",",","the","user","might","need","to","adjust","``","data_range","``",".","``","y_pred","``","and","``","y","``","should","have","the","same","shape",".","For","more","information","on","how","metric","works","with",":","class",":","`","~ignite.engine.engine.Engine","`",",","visit",":","ref",":","`","attach-engine","`",".","..","include",":",":","defaults.rst",":","start-after",":",":","orphan",":","..","testcode",":",":","metric","=","SSIM","(","data_range=1.0",")","metric.attach","(","default_evaluator",",","'ssim","'",")","preds","=","torch.rand","(","[","4",",","3",",","16",",","16","]",")","target","=","preds","*","0.75","state","=","default_evaluator.run","(","[","[","preds",",","target","]","]",")","print","(","state.metrics","[","'ssim","'","]",")","..","testoutput",":",":","0.9218971","...","..","versionadded",":",":","0.4.2"]
code: def _uniform(self, kernel_size: int) -> torch.Tensor:
      kernel = torch.zeros(kernel_size)
  
      start_uniform_index = max(kernel_size // 2 - 2, 0)
      end_uniform_index = min(kernel_size // 2 + 3, kernel_size)
  
      min_, max_ = -2.5, 2.5
      kernel[start_uniform_index:end_uniform_index] = 1 / (max_ - min_)
  
      return kernel.unsqueeze(dim=0)
  
file_path: ignite/ignite/metrics/ssim.py
imports: import warnings
  from typing import Callable, Optional, Sequence, Union
  import torch
  import torch.nn.functional
  from ignite.exceptions import NotComputableError
  from ignite.metrics.metric import Metric, reinit__is_reduced, sync_all_reduce
label_desc: Use image node_id 3 for calling the SSIM obj's underlying member method code with example usage: obj._uniform(kernel_size) and returns: kernel