code: def _stft(
      x: torch.Tensor,
      fft_size: int,
      hop_length: int,
      win_length: int,
      window: tp.Optional[torch.Tensor],
      normalized: bool,
  ) -> torch.Tensor:
      """Perform STFT and convert to magnitude spectrogram.
  
      Args:
          x: Input signal tensor (B, C, T).
          fft_size (int): FFT size.
          hop_length (int): Hop size.
          win_length (int): Window length.
          window (torch.Tensor or None): Window function type.
          normalized (bool): Whether to normalize the STFT or not.
  
      Returns:
          torch.Tensor: Magnitude spectrogram (B, C, #frames, fft_size // 2 + 1).
      """
      B, C, T = x.shape
      x_stft = torch.stft(
          x.view(-1, T),
          fft_size,
          hop_length,
          win_length,
          window,
          normalized=normalized,
          return_complex=True,
      )
      x_stft = x_stft.view(B, C, *x_stft.shape[1:])
      real = x_stft.real
      imag = x_stft.imag
  
      # NOTE(kan-bayashi): clamp is needed to avoid nan or inf
      return torch.sqrt(
          torch.clamp(real**2 + imag**2, min=1e-7)
      ).transpose(2, 1)
  
imports: import typing
  import torch
  from torch import nn
  from torch.nn import functional
label_desc: Use image node_id 1 for calling a global function with example usage: _stft(x, fft_size, hop_length, win_length, window, normalized) and returns: torch