class_docstr: Spectogram Denoiser.
  
  Ref: https://arxiv.org/pdf/2207.06389.pdf.
docstr: Initialization.
  
  Args:
      idim (int): Dimension of the inputs.
      adim (int, optional):Dimension of the hidden states. Defaults to 256.
      layers (int, optional): Number of layers. Defaults to 20.
      channels (int, optional): Number of channels of each layer. Defaults to 256.
      cycle_length (int, optional): Cycle length of the diffusion. Defaults to 1.
      timesteps (int, optional): Number of timesteps of the diffusion.
          Defaults to 200.
      timescale (int, optional): Number of timescale. Defaults to 1.
      max_beta (float, optional): Maximum beta value for schedueler.
          Defaults to 40.
      scheduler (str, optional): Type of noise scheduler. Defaults to "vpsde".
      dropout_rate (float, optional): Dropout rate. Defaults to 0.05.
docstr_tok: ["Initialization",".","Args",":","idim","(","int",")",":","Dimension","of","the","inputs",".","adim","(","int",",","optional",")",":","Dimension","of","the","hidden","states",".","Defaults","to","256.","layers","(","int",",","optional",")",":","Number","of","layers",".","Defaults","to","20.","channels","(","int",",","optional",")",":","Number","of","channels","of","each","layer",".","Defaults","to","256.","cycle_length","(","int",",","optional",")",":","Cycle","length","of","the","diffusion",".","Defaults","to","1.","timesteps","(","int",",","optional",")",":","Number","of","timesteps","of","the","diffusion",".","Defaults","to","200.","timescale","(","int",",","optional",")",":","Number","of","timescale",".","Defaults","to","1.","max_beta","(","float",",","optional",")",":","Maximum","beta","value","for","schedueler",".","Defaults","to","40.","scheduler","(","str",",","optional",")",":","Type","of","noise","scheduler",".","Defaults","to","``","vpsde","''",".","dropout_rate","(","float",",","optional",")",":","Dropout","rate",".","Defaults","to","0.05","."]
code: def __init__(
      self,
      idim: int,
      adim: int = 256,
      layers: int = 20,
      channels: int = 256,
      cycle_length: int = 1,
      timesteps: int = 200,
      timescale: int = 1,
      max_beta: float = 40.0,
      scheduler: str = "vpsde",
      dropout_rate: float = 0.05,
  ) -> None:
      """Initialization.
  
      Args:
          idim (int): Dimension of the inputs.
          adim (int, optional):Dimension of the hidden states. Defaults to 256.
          layers (int, optional): Number of layers. Defaults to 20.
          channels (int, optional): Number of channels of each layer. Defaults to 256.
          cycle_length (int, optional): Cycle length of the diffusion. Defaults to 1.
          timesteps (int, optional): Number of timesteps of the diffusion.
              Defaults to 200.
          timescale (int, optional): Number of timescale. Defaults to 1.
          max_beta (float, optional): Maximum beta value for schedueler.
              Defaults to 40.
          scheduler (str, optional): Type of noise scheduler. Defaults to "vpsde".
          dropout_rate (float, optional): Dropout rate. Defaults to 0.05.
  
      """
      super().__init__()
      self.idim = idim
      self.timesteps = timesteps
      self.scale = timescale
      self.num_layers = layers
      self.channels = channels
  
      # Denoiser
      self.in_proj = nn.Conv1d(idim, channels, 1)
      self.denoiser_pos = PositionalEncoding(channels, dropout_rate)
      self.denoiser_mlp = nn.Sequential(
          nn.Linear(channels, channels * 4),
          Mish(),
          nn.Linear(channels * 4, channels),
      )
      self.denoiser_res = nn.ModuleList(
          [
              ResidualBlock(adim, channels, 2 ** (i % cycle_length))
              for i in range(layers)
          ]
      )
      self.skip_proj = nn.Conv1d(channels, channels, 1)
      self.feats_out = nn.Conv1d(channels, idim, 1)
  
      # Diffusion
      self.betas = noise_scheduler(
          scheduler, timesteps + 1, 0.1, max_beta, 8e-3
      )
      alphas = 1.0 - self.betas
      alphas_cumulative = torch.cumprod(alphas, dim=0)
      self.register_buffer(
          "alphas_cumulative", torch.sqrt(alphas_cumulative)
      )
      self.register_buffer(
          "min_alphas_cumulative", torch.sqrt(1.0 - alphas_cumulative)
      )
  
imports: import math
  from typing import Optional, Union
  import numpy
  import torch
  from torch import nn
  from torch.nn import functional
  from espnet.nets.pytorch_backend.transformer.embedding import PositionalEncoding
label_desc: Use image node_id 1 to create a new SpectogramDenoiser object from inherited base classes: nn with example: obj = SpectogramDenoiser(idim, adim, layers, channels, cycle_length, timesteps, timescale, max_beta, scheduler, dropout_rate)