class_docstr: Tests for compatibility with TorchScript.
class_docstr_tok: ["Tests","for","compatibility","with","TorchScript","."]
docstr: Test loading of single ScriptModule shared by multiple eager
  modules in single pickle (ScriptModule objects should be the same).
docstr_tok: ["Test","loading","of","single","ScriptModule","shared","by","multiple","eager","modules","in","single","pickle","(","ScriptModule","objects","should","be","the","same",")","."]
code: def test_load_shared_scriptmodules(self):
      """
      Test loading of single ScriptModule shared by multiple eager
      modules in single pickle (ScriptModule objects should be the same).
      """
      from package_a.test_module import (
          ModWithMultipleSubmods,
          ModWithSubmod,
          SimpleTest,
      )
  
      scripted_mod = torch.jit.script(SimpleTest())
  
      mod1 = ModWithSubmod(scripted_mod)
      mod2 = ModWithSubmod(scripted_mod)
  
      mod_parent = ModWithMultipleSubmods(mod1, mod2)
  
      buffer = BytesIO()
      with PackageExporter(buffer) as e:
          e.intern("**")
          e.save_pickle("res", "mod.pkl", mod_parent)
  
      buffer.seek(0)
      importer = PackageImporter(buffer)
  
      loaded_mod = importer.load_pickle("res", "mod.pkl")
      self.assertTrue(
          id(loaded_mod.mod1.script_mod)
          == id(loaded_mod.mod2.script_mod)
      )
  
imports: from io import BytesIO
  from textwrap import dedent
  from unittest import skipIf
  import torch
  from torch.package import PackageExporter, PackageImporter
  from torch.testing._internal.common_utils import IS_FBCODE, IS_SANDCASTLE, run_tests
label_desc: Use image node_id 16 for calling the TestPackageScript obj's underlying member method code with example usage: obj.test_load_shared_scriptmodules() without return types