code: def test_rand_shift():
      from speechbrain.augment.freq_domain import RandomShift
  
      signal = torch.rand(4, 256, 8)
      lengths = torch.tensor([0.1, 0.2, 0.9, 1.0])
      rand_shift = RandomShift(min_shift=10, max_shift=50, dim=1)
      output, lengths = rand_shift(signal, lengths)
      assert signal.shape == output.shape
      assert torch.equal(signal, output) == 0
  
      signal = torch.rand(4, 256, 8)
      rand_shift = RandomShift(min_shift=1, max_shift=2, dim=2)
      output, lengths = rand_shift(signal, lengths)
      assert signal.shape == output.shape
      assert torch.equal(signal, output) == 0
  
      signal = torch.rand(4, 256)
      rand_shift = RandomShift(min_shift=10, max_shift=50, dim=1)
      output, lengths = rand_shift(signal, lengths)
      assert signal.shape == output.shape
      assert torch.equal(signal, output) == 0
  
      signal = torch.rand(4, 256, 8)
      rand_shift = RandomShift(min_shift=0, max_shift=0, dim=1)
      output, lengths = rand_shift(signal, lengths)
      assert torch.equal(signal, output)
  
      signal = torch.Tensor([1, 0, 0])
      rand_shift = RandomShift(min_shift=1, max_shift=1, dim=0)
      output, lengths = rand_shift(signal, lengths)
      assert torch.equal(output, torch.Tensor([0, 1, 0]))
  
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 11 for calling a global function with example usage: test_rand_shift() without return types