docstr: Verify that scripting Emformer does not change the behavior of method `forward`.
docstr_tok: ["Verify","that","scripting","Emformer","does","not","change","the","behavior","of","method","`","forward","`","."]
code: def test_torchscript_consistency_forward(self):
      r"""Verify that scripting Emformer does not change the behavior of method `forward`."""
      input_dim = 128
      batch_size = 10
      num_frames = 400
      right_context_length = 1
  
      emformer = self.gen_model(input_dim, right_context_length)
      input, lengths = self.gen_inputs(
          input_dim, batch_size, num_frames, right_context_length
      )
      scripted = torch_script(emformer)
  
      ref_out, ref_len = emformer(input, lengths)
      scripted_out, scripted_len = scripted(input, lengths)
  
      self.assertEqual(ref_out, scripted_out)
      self.assertEqual(ref_len, scripted_len)
  
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 4 for calling the EmformerTestMixin obj's underlying member method code with example usage: obj.test_torchscript_consistency_forward() without return types