class_docstr: Class that manages the training loop. See speechbrain.core.Brain.
class_docstr_tok: ["Class","that","manages","the","training","loop",".","See","speechbrain.core.Brain","."]
docstr: Augments the tokens batch if needed.
  
  Arguments
  ---------
  stage : sb.Stage
      Currently executing stage.
  tokens : tuple
      The tokens (tensor) and their lengths (tensor).
  
  Returns
  -------
  tuple
      Augmented tokens and their lengths.
docstr_tok: ["Augments","the","tokens","batch","if","needed",".","Arguments","--","--","--","--","-","stage",":","sb.Stage","Currently","executing","stage",".","tokens",":","tuple","The","tokens","(","tensor",")","and","their","lengths","(","tensor",")",".","Returns","--","--","--","-","tuple","Augmented","tokens","and","their","lengths","."]
code: def prepare_tokens(self, stage, tokens):
      """
      Augments the tokens batch if needed.
  
      Arguments
      ---------
      stage : sb.Stage
          Currently executing stage.
      tokens : tuple
          The tokens (tensor) and their lengths (tensor).
  
      Returns
      -------
      tuple
          Augmented tokens and their lengths.
      """
      tokens, token_lens = tokens
      if stage == sb.Stage.TRAIN:
          if hasattr(self.hparams, "wav_augment"):
              tokens = self.hparams.wav_augment.replicate_labels(tokens)
              token_lens = self.hparams.wav_augment.replicate_labels(
                  token_lens
              )
          if hasattr(self.hparams, "fea_augment"):
              tokens = self.hparams.fea_augment.replicate_labels(tokens)
              token_lens = self.hparams.fea_augment.replicate_labels(
                  token_lens
              )
      return tokens, token_lens
  
file_path: speechbrain/templates/speech_recognition/ASR/train.py
imports: import sys
  import torch
  import logging
  import speechbrain
  from hyperpyyaml import load_hyperpyyaml
  from mini_librispeech_prepare import prepare_mini_librispeech
  from speechbrain.utils.distributed import run_on_main
label_desc: Use image node_id 4 for calling the ASR obj's underlying member method code with example usage: obj.prepare_tokens(stage, tokens) and returns: tokens,  token_lens