code: def test_augment_pipeline():
      from speechbrain.augment.time_domain import DropFreq, DropChunk
      from speechbrain.augment.augmenter import Augmenter
  
      freq_dropper = DropFreq()
      chunk_dropper = DropChunk(
          drop_start=100, drop_end=16000, noise_factor=0
      )
      augment = Augmenter(
          parallel_augment=False,
          concat_original=False,
          min_augmentations=2,
          max_augmentations=2,
          augmentations=[freq_dropper, chunk_dropper],
      )
      signal = torch.rand([4, 16000])
      output_signal, lenghts = augment(
          signal, lengths=torch.tensor([0.2, 0.5, 0.7, 1.0])
      )
      assert len(output_signal) == 4
      assert len(lenghts) == 4
  
      freq_dropper = DropFreq()
      chunk_dropper = DropChunk(
          drop_start=100, drop_end=16000, noise_factor=0
      )
      augment = Augmenter(
          parallel_augment=True,
          concat_original=True,
          min_augmentations=1,
          max_augmentations=2,
          augment_prob=0,
          augmentations=[freq_dropper, chunk_dropper],
      )
      signal = torch.rand([4, 16000])
      output_signal, lenghts = augment(
          signal, lengths=torch.tensor([0.2, 0.5, 0.7, 1.0])
      )
      assert torch.equal(signal, output_signal)
  
      freq_dropper = DropFreq()
      chunk_dropper = DropChunk(
          drop_start=100, drop_end=16000, noise_factor=0
      )
      augment = Augmenter(
          parallel_augment=True,
          concat_original=True,
          min_augmentations=1,
          max_augmentations=2,
          augment_prob=1.0,
          augmentations=[freq_dropper, chunk_dropper],
          enable_augmentations=[False, False],
      )
      signal = torch.rand([4, 16000])
      output_signal, lenghts = augment(
          signal, lengths=torch.tensor([0.2, 0.5, 0.7, 1.0])
      )
      assert torch.equal(signal, output_signal)
  
      freq_dropper = DropFreq()
      chunk_dropper = DropChunk(
          drop_start=100, drop_end=16000, noise_factor=0
      )
      augment = Augmenter(
          parallel_augment=True,
          concat_original=True,
          min_augmentations=2,
          max_augmentations=2,
          augment_prob=1.0,
          augmentations=[freq_dropper, chunk_dropper],
          enable_augmentations=[True, False],
      )
      signal = torch.rand([4, 16000])
      output_signal, lenghts = augment(
          signal, lengths=torch.tensor([0.2, 0.5, 0.7, 1.0])
      )
      assert output_signal.shape[0] == signal.shape[0] * 2
  
      augment = Augmenter(
          parallel_augment=False,
          concat_original=True,
          min_augmentations=2,
          max_augmentations=2,
          augmentations=[freq_dropper, chunk_dropper],
      )
      output_signal, lenghts = augment(
          signal, lengths=torch.tensor([0.2, 0.5, 0.7, 1.0])
      )
      assert len(output_signal) == 8
      assert len(lenghts) == 8
      assert torch.equal(output_signal[0:4], signal[0:4])
  
      augment = Augmenter(
          parallel_augment=True,
          concat_original=False,
          min_augmentations=2,
          max_augmentations=2,
          augmentations=[freq_dropper, chunk_dropper],
      )
      output_signal, lenghts = augment(
          signal, lengths=torch.tensor([0.2, 0.5, 0.7, 1.0])
      )
      assert len(output_signal) == 8
      assert len(lenghts) == 8
  
      augment = Augmenter(
          parallel_augment=True,
          concat_original=True,
          min_augmentations=2,
          max_augmentations=2,
          augmentations=[freq_dropper, chunk_dropper],
      )
      output_signal, lenghts = augment(
          signal, lengths=torch.tensor([0.2, 0.5, 0.7, 1.0])
      )
      assert len(output_signal) == 12
      assert len(lenghts) == 12
      assert torch.equal(output_signal[0:4], signal[0:4])
  
      augment = Augmenter(
          parallel_augment=True,
          concat_original=True,
          min_augmentations=2,
          max_augmentations=2,
          repeat_augment=2,
          shuffle_augmentations=True,
          augmentations=[freq_dropper, chunk_dropper],
      )
  
      output_signal, lenghts = augment(
          signal, lengths=torch.tensor([0.2, 0.5, 0.7, 1.0])
      )
      assert len(output_signal) == 20
      assert len(lenghts) == 20
      assert torch.equal(output_signal[0:4], signal[0:4])
  
      augment = Augmenter(
          parallel_augment=True,
          concat_original=True,
          min_augmentations=0,
          max_augmentations=0,
          repeat_augment=2,
          shuffle_augmentations=True,
          augmentations=[freq_dropper, chunk_dropper],
      )
  
      output_signal, lenghts = augment(
          signal, lengths=torch.tensor([0.2, 0.5, 0.7, 1.0])
      )
      assert torch.equal(output_signal, signal)
  
      augment = Augmenter(
          parallel_augment=True,
          concat_original=True,
          min_augmentations=1,
          max_augmentations=2,
          repeat_augment=0,
          shuffle_augmentations=True,
          augmentations=[freq_dropper, chunk_dropper],
      )
  
      output_signal, lenghts = augment(
          signal, lengths=torch.tensor([0.2, 0.5, 0.7, 1.0])
      )
      assert torch.equal(output_signal, signal)
  
file_path: speechbrain/tests/unittests/test_augment.py
imports: import os
  import torch
  import torchaudio
  from speechbrain.dataio.dataio import write_audio
label_desc: Use image node_id 14 for calling a global function with example usage: test_augment_pipeline() without return types