docstr: Transfers the batch to the target device
  Arguments
  ---------
  batch: tuple
      the batch to use
  Returns
  -------
  batch: tuple
      the batch on the correct device
docstr_tok: ["Transfers","the","batch","to","the","target","device","Arguments","--","--","--","--","-","batch",":","tuple","the","batch","to","use","Returns","--","--","--","-","batch",":","tuple","the","batch","on","the","correct","device"]
code: def batch_to_device(self, batch, return_metadata=False):
      """Transfers the batch to the target device
      Arguments
      ---------
      batch: tuple
          the batch to use
      Returns
      -------
      batch: tuple
          the batch on the correct device
      """
  
      (
          phoneme_padded,
          input_lengths,
          mel_padded,
          pitch_padded,
          energy_padded,
          output_lengths,
          # len_x,
          labels,
          wavs,
      ) = batch
  
      # durations = durations.to(self.device, non_blocking=True).long()
      phonemes = phoneme_padded.to(
          self.device, non_blocking=True
      ).long()
      input_lengths = input_lengths.to(
          self.device, non_blocking=True
      ).long()
      spectogram = mel_padded.to(self.device, non_blocking=True).float()
      pitch = pitch_padded.to(self.device, non_blocking=True).float()
      energy = energy_padded.to(self.device, non_blocking=True).float()
      mel_lengths = output_lengths.to(
          self.device, non_blocking=True
      ).long()
      x = (phonemes, spectogram, pitch, energy)
      y = (spectogram, pitch, energy, mel_lengths, input_lengths)
      metadata = (labels, wavs)
      if return_metadata:
          return x, y, metadata
      return x, y
  
imports: import os
  import sys
  import torch
  import logging
  import torchaudio
  import numpy
  import speechbrain
  from speechbrain.inference.vocoders import HIFIGAN
  from pathlib import Path
  from hyperpyyaml import load_hyperpyyaml
  from speechbrain.utils.data_utils import scalarize
label_desc: Use image node_id 10 for calling the FastSpeech2Brain obj's underlying member method code with example usage: obj.batch_to_device(batch, return_metadata) and returns: x,  y, x,  y,  metadata