code: def spectrogram_func_librosa(
      nfft, win_len, win_step, window, center, input_data
  ):
      # Squeeze to 1d
      if len(input_data.shape) > 1:
          input_data = np.squeeze(input_data)
  
      if window is None:
          window = hann_win
  
      out = (
          np.abs(
              librosa.stft(
                  y=input_data,
                  n_fft=nfft or win_len,
                  center=center,
                  win_length=win_len,
                  hop_length=win_step,
                  window=window,
              )
          )
          ** 2
      )
  
      # Alternative way to calculate the spectrogram:
      # out, _ = librosa.core.spectrum._spectrogram(
      #     y=input_data, n_fft=nfft, hop_length=win_step, window=hann_win, power=2)
  
      return out
  
imports: from nvidia.dali.pipeline import Pipeline
  import nvidia.dali.ops
  import nvidia.dali.types
  import nvidia.dali
  import numpy
  from functools import partial
  from test_utils import get_files
  from test_utils import compare_pipelines
  from test_utils import RandomDataIterator
  from test_utils import ConstantDataIterator
  import librosa
  import math
label_desc: Use image node_id 3 for calling a global function with example usage: spectrogram_func_librosa(nfft, win_len, win_step, window, center, input_data) and returns: out