class_docstr: Tests for compatibility with TorchScript.
class_docstr_tok: ["Tests","for","compatibility","with","TorchScript","."]
docstr: Test saving inline and imported modules in same package with
  independent code.
docstr_tok: ["Test","saving","inline","and","imported","modules","in","same","package","with","independent","code","."]
code: def test_mixing_packaged_and_inline_modules(self):
      """
      Test saving inline and imported modules in same package with
      independent code.
      """
  
      class InlineMod(torch.nn.Module):
          def __init__(self, name: str):
              super().__init__()
              self.name = name
              self.tensor = torch.rand(1, 2, 3)
  
          def forward(self, input: str):
              input = input + "_modInline:" + self.name
              return input, (self.tensor * 4)
  
      inline_mod = InlineMod("inline")
      scripted_inline = torch.jit.script(inline_mod)
  
      from package_a.test_module import SimpleTest
  
      imported_mod = SimpleTest()
      scripted_imported = torch.jit.script(imported_mod)
  
      buffer = BytesIO()
      with PackageExporter(buffer) as e:
          e.save_pickle("model", "inline.pkl", scripted_inline)
          e.save_pickle("model", "imported.pkl", scripted_imported)
  
      buffer.seek(0)
      importer = PackageImporter(buffer)
      loaded_inline = importer.load_pickle("model", "inline.pkl")
      loaded_imported = importer.load_pickle("model", "imported.pkl")
  
      input = torch.rand(2, 3)
      self.assertEqual(loaded_imported(input), imported_mod(input))
      self.assertEqual(loaded_inline("input"), inline_mod("input"))
  
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 21 for calling the TestPackageScript obj's underlying member method code with example usage: obj.test_mixing_packaged_and_inline_modules() and returns: input,  unknown