code: def inverse_spectrogram(
      spectrogram: Tensor,
      length: Optional[int],
      pad: int,
      window: Tensor,
      n_fft: int,
      hop_length: int,
      win_length: int,
      normalized: Union[bool, str],
      center: bool = True,
      pad_mode: str = "reflect",
      onesided: bool = True,
  ) -> Tensor:
      r"""Create an inverse spectrogram or a batch of inverse spectrograms from the provided
      complex-valued spectrogram.
  
      .. devices:: CPU CUDA
  
      .. properties:: Autograd TorchScript
  
      Args:
          spectrogram (Tensor): Complex tensor of audio of dimension (..., freq, time).
          length (int or None): The output length of the waveform.
          pad (int): Two sided padding of signal. It is only effective when ``length`` is provided.
          window (Tensor): Window tensor that is applied/multiplied to each frame/window
          n_fft (int): Size of FFT
          hop_length (int): Length of hop between STFT windows
          win_length (int): Window size
          normalized (bool or str): Whether the stft output was normalized by magnitude. If input is str, choices are
              ``"window"`` and ``"frame_length"``, dependent on normalization mode. ``True`` maps to
              ``"window"``.
          center (bool, optional): whether the waveform was padded on both sides so
              that the :math:`t`-th frame is centered at time :math:`t \times \text{hop\_length}`.
              Default: ``True``
          pad_mode (string, optional): controls the padding method used when
              :attr:`center` is ``True``. This parameter is provided for compatibility with the
              spectrogram function and is not used. Default: ``"reflect"``
          onesided (bool, optional): controls whether spectrogram was done in onesided mode.
              Default: ``True``
  
      Returns:
          Tensor: Dimension `(..., time)`. Least squares estimation of the original signal.
      """
  
      frame_length_norm, window_norm = _get_spec_norms(normalized)
  
      if not spectrogram.is_complex():
          raise ValueError(
              "Expected `spectrogram` to be complex dtype."
          )
  
      if window_norm:
          spectrogram = spectrogram * window.pow(2.0).sum().sqrt()
  
      # pack batch
      shape = spectrogram.size()
      spectrogram = spectrogram.reshape(-1, shape[-2], shape[-1])
  
      # default values are consistent with librosa.core.spectrum._spectrogram
      waveform = torch.istft(
          input=spectrogram,
          n_fft=n_fft,
          hop_length=hop_length,
          win_length=win_length,
          window=window,
          center=center,
          normalized=frame_length_norm,
          onesided=onesided,
          length=length + 2 * pad if length is not None else None,
          return_complex=False,
      )
  
      if length is not None and pad > 0:
          # remove padding from front and back
          waveform = waveform[:, pad:-pad]
  
      # unpack batch
      waveform = waveform.reshape(shape[:-2] + waveform.shape[-1:])
  
      return waveform
  
imports: import math
  import tempfile
  import warnings
  from collections.abc import Sequence
  from typing import List, Optional, Tuple, Union
  import torch
  import torchaudio
  from torch import Tensor
  from torchaudio._internal.module_utils import deprecated
  from .filtering import highpass_biquad, treble_biquad
label_desc: Use image node_id 2 for calling a global function with example usage: inverse_spectrogram(spectrogram, length, pad, window, n_fft, hop_length, win_length, normalized, center, pad_mode, onesided) and returns: waveform