class_docstr: Test functions defined in `functional` module
class_docstr_tok: ["Test","functions","defined","in","`","functional","`","module"]
code: def assert_batch_consistency(
      self, functional, inputs, atol=1e-6, rtol=1e-5, seed=42
  ):
      n = inputs[0].size(0)
      for i in range(1, len(inputs)):
          self.assertEqual(inputs[i].size(0), n)
      # Compute items separately, then batch the result
      torch.random.manual_seed(seed)
      items_input = [
          [ele[i].clone() for ele in inputs] for i in range(n)
      ]
      items_result = torch.stack(
          [functional(*items_input[i]) for i in range(n)]
      )
  
      # Batch the input and run
      torch.random.manual_seed(seed)
      batch_input = [ele.clone() for ele in inputs]
      batch_result = functional(*batch_input)
  
      self.assertEqual(items_result, batch_result, rtol=rtol, atol=atol)
  
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 1 for calling the TestFunctional obj's underlying member method code with example usage: obj.assert_batch_consistency(functional, inputs, atol, rtol, seed) without return types