class_docstr: Test functions defined in `functional` module
class_docstr_tok: ["Test","functions","defined","in","`","functional","`","module"]
code: def test_speed(self):
      B = 5
      orig_freq = 100
      factor = 0.8
      input_lengths = torch.randint(1, 1000, (B,), dtype=torch.int32)
  
      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 = F.speed(
          batched_input,
          orig_freq=orig_freq,
          factor=factor,
          lengths=input_lengths,
      )
  
      unbatched_output = []
      unbatched_output_lengths = []
      for idx in range(len(unbatched_input)):
          w, l = F.speed(
              unbatched_input[idx],
              orig_freq=orig_freq,
              factor=factor,
              lengths=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 itertools
  import math
  from functools import partial
  import torch
  import torchaudio.functional
  from parameterized import parameterized, parameterized_class
  from torchaudio_unittest import common_utils
label_desc: Use image node_id 28 for calling the TestFunctional obj's underlying member method code with example usage: obj.test_speed() without return types