code: def waveglow_log_to_tb_func(
      swriter,
      tensors,
      step,
      tag="train",
      n_fft=1024,
      hop_length=256,
      window="hann",
      mel_fb=None,
  ):
      _, audio_pred, spec_target, mel_length = tensors
      mel_length = mel_length[0]
      spec_target = spec_target[0].data.cpu().numpy()[:, :mel_length]
      swriter.add_image(
          f"{tag}_mel_target",
          plot_spectrogram_to_numpy(spec_target),
          step,
          dataformats="HWC",
      )
      if mel_fb is not None:
          mag, _ = librosa.core.magphase(
              librosa.core.stft(
                  np.nan_to_num(audio_pred[0].cpu().detach().numpy()),
                  n_fft=n_fft,
                  hop_length=hop_length,
                  window=window,
              )
          )
          mel_pred = np.matmul(mel_fb.cpu().numpy(), mag).squeeze()
          log_mel_pred = np.log(
              np.clip(mel_pred, a_min=1e-5, a_max=None)
          )
          swriter.add_image(
              f"{tag}_mel_predicted",
              plot_spectrogram_to_numpy(log_mel_pred[:, :mel_length]),
              step,
              dataformats="HWC",
          )
  
imports: from enum import Enum
  from typing import Optional, Tuple
  import librosa
  import matplotlib.pylab
  import numpy
  import torch
  from einops import rearrange
  from numba import jit, prange
  from nemo.collections.tts.torch.tts_data_types import DATA_STR2DATA_CLASS, MAIN_DATA_TYPES, WithLens
  from nemo.utils import logging
  from nemo.utils.decorators import deprecated
label_desc: Use image node_id 22 for calling a global function with example usage: waveglow_log_to_tb_func(swriter, tensors, step, tag, n_fft, hop_length, window, mel_fb) without return types