class_docstr: SSimLoss.
  
  This is an implementation of structural similarity (SSIM) loss.
  This code is modified from https://github.com/Po-Hsun-Su/pytorch-ssim.
class_docstr_tok: ["SSimLoss",".","This","is","an","implementation","of","structural","similarity","(","SSIM",")","loss",".","This","code","is","modified","from","https",":","\/\/github.com\/Po-Hsun-Su\/pytorch-ssim","."]
docstr: Initialization.
  
  Args:
      bias (float, optional): value of the bias. Defaults to 6.0.
      window_size (int, optional): Window size. Defaults to 11.
      channels (int, optional): Number of channels. Defaults to 1.
      reduction (str, optional): Type of reduction during the loss
          calculation. Defaults to "none".
docstr_tok: ["Initialization",".","Args",":","bias","(","float",",","optional",")",":","value","of","the","bias",".","Defaults","to","6.0.","window_size","(","int",",","optional",")",":","Window","size",".","Defaults","to","11.","channels","(","int",",","optional",")",":","Number","of","channels",".","Defaults","to","1.","reduction","(","str",",","optional",")",":","Type","of","reduction","during","the","loss","calculation",".","Defaults","to","``","none","''","."]
code: def __init__(
      self,
      bias: float = 6.0,
      window_size: int = 11,
      channels: int = 1,
      reduction: str = "none",
  ):
      """Initialization.
  
      Args:
          bias (float, optional): value of the bias. Defaults to 6.0.
          window_size (int, optional): Window size. Defaults to 11.
          channels (int, optional): Number of channels. Defaults to 1.
          reduction (str, optional): Type of reduction during the loss
              calculation. Defaults to "none".
  
      """
      super().__init__()
      self.bias = bias
      self.win_len = window_size
      self.channels = channels
      self.average = False
      if reduction == "mean":
          self.average = True
  
      win1d = gaussian(window_size, 1.5).unsqueeze(1)
      win2d = win1d.mm(win1d.t()).float().unsqueeze(0).unsqueeze(0)
      self.window = torch.Tensor(
          win2d.expand(
              channels, 1, window_size, window_size
          ).contiguous()
      )
  
file_path: espnet/espnet2/tts/prodiff/loss.py
imports: from math import exp
  from typing import Tuple
  import torch
  from torch.nn import functional
  from typeguard import check_argument_types
  from espnet.nets.pytorch_backend.fastspeech.duration_predictor import DurationPredictorLoss
  from espnet.nets.pytorch_backend.nets_utils import make_non_pad_mask
label_desc: Use image node_id 1 to create a new SSimLoss object from inherited base classes: torch.nn with example: obj = SSimLoss(bias, window_size, channels, reduction)