class_docstr: The Brain implementation for Tacotron2
class_docstr_tok: ["The","Brain","implementation","for","Tacotron2"]
docstr: Transfers the batch to the target device
  
  Arguments
  ---------
  batch: tuple
      the batch to use
  
  Returns
  -------
  batch: tiuple
      the batch on the correct device
docstr_tok: ["Transfers","the","batch","to","the","target","device","Arguments","--","--","--","--","-","batch",":","tuple","the","batch","to","use","Returns","--","--","--","-","batch",":","tiuple","the","batch","on","the","correct","device"]
code: def batch_to_device(self, batch):
      """Transfers the batch to the target device
  
      Arguments
      ---------
      batch: tuple
          the batch to use
  
      Returns
      -------
      batch: tiuple
          the batch on the correct device
      """
      (
          text_padded,
          input_lengths,
          mel_padded,
          gate_padded,
          output_lengths,
          len_x,
          labels,
          wavs,
      ) = batch
      text_padded = text_padded.to(
          self.device, non_blocking=True
      ).long()
      input_lengths = input_lengths.to(
          self.device, non_blocking=True
      ).long()
      max_len = torch.max(input_lengths.data).item()
      mel_padded = mel_padded.to(self.device, non_blocking=True).float()
      gate_padded = gate_padded.to(
          self.device, non_blocking=True
      ).float()
  
      output_lengths = output_lengths.to(
          self.device, non_blocking=True
      ).long()
      x = (
          text_padded,
          input_lengths,
          mel_padded,
          max_len,
          output_lengths,
      )
      y = (mel_padded, gate_padded)
      len_x = torch.sum(output_lengths)
      return (x, y, len_x, labels, wavs)
  
file_path: speechbrain/recipes/LJSpeech/TTS/tacotron2/train.py
imports: import torch
  import speechbrain
  import sys
  import logging
  from hyperpyyaml import load_hyperpyyaml
  from speechbrain.utils.text_to_sequence import text_to_sequence
  from speechbrain.utils.data_utils import scalarize
label_desc: Use image node_id 7 for calling the Tacotron2Brain obj's underlying member method code with example usage: obj.batch_to_device(batch) and returns: x,  y,  len_x,  labels,  wavs