code: def test_module_swap(self):
      @torch.jit.interface
      class ModuleInterface(nn.Module):
          def one(self, inp1: Tensor, inp2: Tensor) -> Tensor:
              pass
  
          def forward(self, input: Tensor) -> Tensor:
              pass
  
      class TestModule(nn.Module):
          proxy_mod: ModuleInterface
  
          def __init__(self):
              super().__init__()
              self.proxy_mod = OrigModule()
  
          def forward(self, input: Tensor) -> Tensor:
              return self.proxy_mod.forward(input)
  
      scripted_mod = torch.jit.script(TestModule())
      input = torch.randn(3, 4)
      self.assertEqual(scripted_mod(input), 3 * input + 2)
  
      # module swap with module that have the same interface
      scripted_mod.proxy_mod = torch.jit.script(NewModule())
      self.assertEqual(scripted_mod(input), input * (input + 1) + 1)
  
      # module swap with non-scripted module should throw error
      with self.assertRaisesRegex(
          RuntimeError, "a ScriptModule with non-scripted module"
      ):
          scripted_mod.proxy_mod = NewModule()
  
imports: from typing import List, Any
  import torch
  import torch.nn
  import os
  import sys
  from torch import Tensor
  from torch.testing._internal.jit_utils import JitTestCase, make_global
label_desc: Use image node_id 6 for calling the TestModuleInterface obj's underlying member method code with example usage: obj.test_module_swap() and returns: self