docstr: Verify that scripting Emformer does not change the behavior of method `infer`.
docstr_tok: ["Verify","that","scripting","Emformer","does","not","change","the","behavior","of","method","`","infer","`","."]
code: def test_torchscript_consistency_infer(self):
      r"""Verify that scripting Emformer does not change the behavior of method `infer`."""
      input_dim = 128
      batch_size = 10
      num_frames = 5
      right_context_length = 1
  
      emformer = self.gen_model(input_dim, right_context_length).eval()
      scripted = torch_script(emformer).eval()
  
      ref_state, scripted_state = None, None
      for _ in range(3):
          input, lengths = self.gen_inputs(
              input_dim, batch_size, num_frames, right_context_length
          )
          ref_out, ref_len, ref_state = emformer.infer(
              input, lengths, ref_state
          )
          scripted_out, scripted_len, scripted_state = scripted.infer(
              input, lengths, scripted_state
          )
          self.assertEqual(ref_out, scripted_out)
          self.assertEqual(ref_len, scripted_len)
          self.assertEqual(ref_state, scripted_state)
  
file_path: audio/test/torchaudio_unittest/models/emformer/emformer_test_impl.py
imports: from abc import ABC, abstractmethod
  import torch
  from torchaudio.models import Emformer
  from torchaudio_unittest.common_utils import TestBaseMixin, torch_script
label_desc: Use image node_id 5 for calling the EmformerTestMixin obj's underlying member method code with example usage: obj.test_torchscript_consistency_infer() without return types