code: def test_backport_bytecode_from_file_to_file(self):
      maximum_checked_in_model_version = max(
          SCRIPT_MODULE_BYTECODE_PKL.keys()
      )
      script_module_v5_path = (
          pytorch_test_dir
          / "cpp"
          / "jit"
          / SCRIPT_MODULE_BYTECODE_PKL[
              maximum_checked_in_model_version
          ]["model_name"]
      )
  
      if maximum_checked_in_model_version > MINIMUM_TO_VERSION:
          with tempfile.TemporaryDirectory() as tmpdirname:
              tmp_backport_model_path = Path(
                  tmpdirname,
                  "tmp_script_module_v5_backported_to_v4.ptl",
              )
              # backport from file
              success = _backport_for_mobile(
                  script_module_v5_path,
                  tmp_backport_model_path,
                  maximum_checked_in_model_version - 1,
              )
              assert success
  
              buf = io.StringIO()
              torch.utils.show_pickle.main(
                  [
                      "",
                      tmpdirname
                      + "/"
                      + tmp_backport_model_path.name
                      + "@*/bytecode.pkl",
                  ],
                  output_stream=buf,
              )
              output = buf.getvalue()
  
              expected_result = SCRIPT_MODULE_V4_BYTECODE_PKL
              acutal_result_clean = "".join(output.split())
              expect_result_clean = "".join(expected_result.split())
              isMatch = fnmatch.fnmatch(
                  acutal_result_clean, expect_result_clean
              )
              assert isMatch
  
              # Load model v4 and run forward method
              mobile_module = _load_for_lite_interpreter(
                  str(tmp_backport_model_path)
              )
              module_input = 1
              mobile_module_result = mobile_module(module_input)
              expected_mobile_module_result = 3 * torch.ones(
                  [2, 4], dtype=torch.float64
              )
              torch.testing.assert_close(
                  mobile_module_result, expected_mobile_module_result
              )
              shutil.rmtree(tmpdirname)
  
file_path: pytorch/test/mobile/test_bytecode.py
imports: import fnmatch
  import io
  import shutil
  import tempfile
  import torch
  import torch.utils.show_pickle
  from torch.jit.mobile import _load_for_lite_interpreter, _get_mobile_model_contained_types, _get_model_bytecode_version, _get_model_ops_and_info, _backport_for_mobile_to_buffer, _backport_for_mobile
  from torch.testing._internal.common_utils import TestCase, run_tests
  from pathlib import Path
label_desc: Use image node_id 3 for calling the testVariousModelVersions obj's underlying member method code with example usage: obj.test_backport_bytecode_from_file_to_file() without return types