class_docstr: Test suite for classes defined in `transforms` module
class_docstr_tok: ["Test","suite","for","classes","defined","in","`","transforms","`","module"]
code: def test_speed_perturbation(self):
      B = 5
      orig_freq = 100
      factor = 0.8
      input_lengths = torch.randint(1, 1000, (B,), dtype=torch.int32)
  
      speed = T.SpeedPerturbation(orig_freq, [factor])
  
      unbatched_input = [
          torch.ones((int(length),)) * 1.0 for length in input_lengths
      ]
      batched_input = torch.nn.utils.rnn.pad_sequence(
          unbatched_input, batch_first=True
      )
  
      output, output_lengths = speed(batched_input, input_lengths)
  
      unbatched_output = []
      unbatched_output_lengths = []
      for idx in range(len(unbatched_input)):
          w, l = speed(unbatched_input[idx], input_lengths[idx])
          unbatched_output.append(w)
          unbatched_output_lengths.append(l)
  
      self.assertEqual(
          output_lengths, torch.stack(unbatched_output_lengths)
      )
      for idx in range(len(unbatched_output)):
          w, l = output[idx], output_lengths[idx]
          self.assertEqual(unbatched_output[idx], w[:l])
  
imports: import os
  import torch
  from parameterized import parameterized
  from torchaudio import transforms
  from torchaudio_unittest import common_utils
label_desc: Use image node_id 25 for calling the TestTransforms obj's underlying member method code with example usage: obj.test_speed_perturbation() without return types