class_docstr: The Brain implementation for Tacotron2
class_docstr_tok: ["The","Brain","implementation","for","Tacotron2"]
docstr: Computes the value of the loss function and updates stats
  
  Arguments
  ---------
  predictions: tuple
      model predictions
  targets: tuple
      ground truth data
  
  Returns
  -------
  loss: torch.Tensor
      the loss value
docstr_tok: ["Computes","the","value","of","the","loss","function","and","updates","stats","Arguments","--","--","--","--","-","predictions",":","tuple","model","predictions","targets",":","tuple","ground","truth","data","Returns","--","--","--","-","loss",":","torch.Tensor","the","loss","value"]
code: def _compute_loss(self, predictions, batch, stage):
      """Computes the value of the loss function and updates stats
  
      Arguments
      ---------
      predictions: tuple
          model predictions
      targets: tuple
          ground truth data
  
      Returns
      -------
      loss: torch.Tensor
          the loss value
      """
      inputs, targets, num_items, labels, wavs = batch
      text_padded, input_lengths, _, max_len, output_lengths = inputs
      loss_stats = self.hparams.criterion(
          predictions,
          targets,
          input_lengths,
          output_lengths,
          self.last_epoch,
      )
      self.last_loss_stats[stage] = scalarize(loss_stats)
      return loss_stats.loss
  
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 5 for calling the Tacotron2Brain obj's underlying member method code with example usage: obj._compute_loss(predictions, batch, stage) and returns: loss_stats