code: def format_data(data):
      # setup input data
      text_input = data["token_id"]
      text_lengths = data["token_id_lengths"]
      mel_input = data["mel"]
      mel_lengths = data["mel_lengths"]
      item_idx = data["item_idxs"]
      d_vectors = data["d_vectors"]
      speaker_ids = data["speaker_ids"]
      attn_mask = data["attns"]
      avg_text_length = torch.mean(text_lengths.float())
      avg_spec_length = torch.mean(mel_lengths.float())
  
      # dispatch data to GPU
      if use_cuda:
          text_input = text_input.cuda(non_blocking=True)
          text_lengths = text_lengths.cuda(non_blocking=True)
          mel_input = mel_input.cuda(non_blocking=True)
          mel_lengths = mel_lengths.cuda(non_blocking=True)
          if speaker_ids is not None:
              speaker_ids = speaker_ids.cuda(non_blocking=True)
          if d_vectors is not None:
              d_vectors = d_vectors.cuda(non_blocking=True)
          if attn_mask is not None:
              attn_mask = attn_mask.cuda(non_blocking=True)
      return (
          text_input,
          text_lengths,
          mel_input,
          mel_lengths,
          speaker_ids,
          d_vectors,
          avg_text_length,
          avg_spec_length,
          attn_mask,
          item_idx,
      )
  
file_path: TTS/TTS/bin/extract_tts_spectrograms.py
imports: import argparse
  import os
  import numpy
  import torch
  from torch.utils.data import DataLoader
  from tqdm import tqdm
  from TTS.config import load_config
  from TTS.tts.datasets import TTSDataset, load_tts_samples
  from TTS.tts.models import setup_model
  from TTS.tts.utils.speakers import SpeakerManager
  from TTS.tts.utils.text.tokenizer import TTSTokenizer
  from TTS.utils.audio import AudioProcessor
  from TTS.utils.audio.numpy_transforms import quantize
  from TTS.utils.generic_utils import count_parameters
label_desc: Use image node_id 3 for calling a global function with example usage: format_data(data) and returns: text_input,  text_lengths,  mel_input,  mel_lengths,  speaker_ids,  d_vectors,  avg_text_length,  avg_spec_length,  attn_mask,  item_idx