code: def spectrogram(
      waveform: Tensor,
      pad: int,
      window: Tensor,
      n_fft: int,
      hop_length: int,
      win_length: int,
      power: Optional[float],
      normalized: Union[bool, str],
      center: bool = True,
      pad_mode: str = "reflect",
      onesided: bool = True,
      return_complex: Optional[bool] = None,
  ) -> Tensor:
      r"""Create a spectrogram or a batch of spectrograms from a raw audio signal.
      The spectrogram can be either magnitude-only or complex.
  
      .. devices:: CPU CUDA
  
      .. properties:: Autograd TorchScript
  
      Args:
          waveform (Tensor): Tensor of audio of dimension `(..., time)`
          pad (int): Two sided padding of signal
          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
          power (float or None): Exponent for the magnitude spectrogram,
              (must be > 0) e.g., 1 for magnitude, 2 for power, etc.
              If None, then the complex spectrum is returned instead.
          normalized (bool or str): Whether to normalize by magnitude after stft. If input is str, choices are
              ``"window"`` and ``"frame_length"``, if specific normalization type is desirable. ``True`` maps to
              ``"window"``. When normalized on ``"window"``, waveform is normalized upon the window's L2 energy. If
              normalized on ``"frame_length"``, waveform is normalized by dividing by
              :math:`(\text{frame\_length})^{0.5}`.
          center (bool, optional): whether to pad :attr:`waveform` 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``. Default: ``"reflect"``
          onesided (bool, optional): controls whether to return half of results to
              avoid redundancy. Default: ``True``
          return_complex (bool, optional):
              Deprecated and not used.
  
      Returns:
          Tensor: Dimension `(..., freq, time)`, freq is
          ``n_fft // 2 + 1`` and ``n_fft`` is the number of
          Fourier bins, and time is the number of window hops (n_frame).
      """
      if return_complex is not None:
          warnings.warn(
              "`return_complex` argument is now deprecated and is not effective."
              "`torchaudio.functional.spectrogram(power=None)` always returns a tensor with "
              "complex dtype. Please remove the argument in the function call."
          )
  
      if pad > 0:
          # TODO add "with torch.no_grad():" back when JIT supports it
          waveform = torch.nn.functional.pad(
              waveform, (pad, pad), "constant"
          )
  
      frame_length_norm, window_norm = _get_spec_norms(normalized)
  
      # pack batch
      shape = waveform.size()
      waveform = waveform.reshape(-1, shape[-1])
  
      # default values are consistent with librosa.core.spectrum._spectrogram
      spec_f = torch.stft(
          input=waveform,
          n_fft=n_fft,
          hop_length=hop_length,
          win_length=win_length,
          window=window,
          center=center,
          pad_mode=pad_mode,
          normalized=frame_length_norm,
          onesided=onesided,
          return_complex=True,
      )
  
      # unpack batch
      spec_f = spec_f.reshape(shape[:-1] + spec_f.shape[-2:])
  
      if window_norm:
          spec_f /= window.pow(2.0).sum().sqrt()
      if power is not None:
          if power == 1.0:
              return spec_f.abs()
          return spec_f.abs().pow(power)
      return spec_f
  
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 1 for calling a global function with example usage: spectrogram(waveform, pad, window, n_fft, hop_length, win_length, power, normalized, center, pad_mode, onesided, return_complex) and returns: spec_f, spec_f, spec_f