class_docstr: Creates a criterion that computes MSSIM + L1 loss.
  
  According to [1], we compute the MS_SSIM + L1 loss as follows:
  
  .. math::
      \text{loss}(x, y) = \alpha \cdot \mathcal{L_{MSSIM}}(x,y)+(1 - \alpha) \cdot G_\alpha \cdot \mathcal{L_1}(x,y)
  
  Where:
      - :math:`\alpha` is the weight parameter.
      - :math:`x` and :math:`y` are the reconstructed and true reference images.
      - :math:`\mathcal{L_{MSSIM}}` is the MS-SSIM loss.
      - :math:`G_\alpha` is the sigma values for computing multi-scale SSIM.
      - :math:`\mathcal{L_1}` is the L1 loss.
  
  Reference:
      [1]: https://research.nvidia.com/sites/default/files/pubs/2017-03_Loss-Functions-for/NN_ImgProc.pdf#page11
  
  Args:
      sigmas: gaussian sigma values.
      data_range: the range of the images.
      K: k values.
      alpha : specifies the alpha value
      compensation: specifies the scaling coefficient.
      reduction : Specifies the reduction to apply to the
       output: ``'none'`` | ``'mean'`` | ``'sum'``. ``'none'``: no reduction will be applied,
       ``'mean'``: the sum of the output will be divided by the number of elements
       in the output, ``'sum'``: the output will be summed.
  
  Returns:
      The computed loss.
  
  Shape:
      - Input1: :math:`(N, C, H, W)`.
      - Input2: :math:`(N, C, H, W)`.
      - Output: :math:`(N, H, W)` or scalar if reduction is set to ``'mean'`` or ``'sum'``.
  
  Examples:
      >>> input1 = torch.rand(1, 3, 5, 5)
      >>> input2 = torch.rand(1, 3, 5, 5)
      >>> criterion = kornia.losses.MS_SSIMLoss()
      >>> loss = criterion(input1, input2)
code: def __init__(
      self,
      sigmas: list[float] = [0.5, 1.0, 2.0, 4.0, 8.0],
      data_range: float = 1.0,
      K: tuple[float, float] = (0.01, 0.03),
      alpha: float = 0.025,
      compensation: float = 200.0,
      reduction: str = "mean",
  ) -> None:
      super().__init__()
      self.DR: float = data_range
      self.C1: float = (K[0] * data_range) ** 2
      self.C2: float = (K[1] * data_range) ** 2
      self.pad = int(2 * sigmas[-1])
      self.alpha: float = alpha
      self.compensation: float = compensation
      self.reduction: str = reduction
  
      # Set filter size
      filter_size = int(4 * sigmas[-1] + 1)
      g_masks = torch.zeros(
          (3 * len(sigmas), 1, filter_size, filter_size)
      )
  
      # Compute mask at different scales
      for idx, sigma in enumerate(sigmas):
          g_masks[3 * idx + 0, 0, :, :] = self._fspecial_gauss_2d(
              filter_size, sigma
          )
          g_masks[3 * idx + 1, 0, :, :] = self._fspecial_gauss_2d(
              filter_size, sigma
          )
          g_masks[3 * idx + 2, 0, :, :] = self._fspecial_gauss_2d(
              filter_size, sigma
          )
  
      self.register_buffer("_g_masks", g_masks)
  
file_path: kornia/kornia/losses/ms_ssim.py
imports: from __future__ import annotations
  from typing import Optional
  import torch
  import torch.nn.functional
  from torch import nn
label_desc: Use image node_id 1 to create a new MS_SSIMLoss object from inherited base classes: nn with example: obj = MS_SSIMLoss(sigmas, data_range, K, alpha, compensation, reduction)