code: def test_torchbind(self):
      def test_equality(f, cmp_key):
          obj1 = f()
          obj2 = torch.jit.script(f)()
          return (cmp_key(obj1), cmp_key(obj2))
  
      def f():
          val = torch.classes._TorchScriptTesting._Foo(5, 3)
          val.increment(1)
          return val
  
      test_equality(f, lambda x: x)
  
      with self.assertRaisesRegex(
          RuntimeError, "Expected a value of type 'int'"
      ):
          val = torch.classes._TorchScriptTesting._Foo(5, 3)
          val.increment("foo")
  
      def f():
          ss = torch.classes._TorchScriptTesting._StackString(
              ["asdf", "bruh"]
          )
          return ss.pop()
  
      test_equality(f, lambda x: x)
  
      def f():
          ss1 = torch.classes._TorchScriptTesting._StackString(
              ["asdf", "bruh"]
          )
          ss2 = torch.classes._TorchScriptTesting._StackString(
              ["111", "222"]
          )
          ss1.push(ss2.pop())
          return ss1.pop() + ss2.pop()
  
      test_equality(f, lambda x: x)
  
      # test nn module with prepare_scriptable function
      class NonJitableClass:
          def __init__(self, int1, int2):
              self.int1 = int1
              self.int2 = int2
  
          def return_vals(self):
              return self.int1, self.int2
  
      class CustomWrapper(torch.nn.Module):
          def __init__(self, foo):
              super().__init__()
              self.foo = foo
  
          def forward(self) -> None:
              self.foo.increment(1)
              return
  
          def __prepare_scriptable__(self):
              int1, int2 = self.foo.return_vals()
              foo = torch.classes._TorchScriptTesting._Foo(int1, int2)
              return CustomWrapper(foo)
  
      foo = CustomWrapper(NonJitableClass(1, 2))
      jit_foo = torch.jit.script(foo)
  
imports: import io
  import os
  import sys
  import copy
  import unittest
  import torch
  from typing import Optional
  from torch.testing._internal.jit_utils import JitTestCase
  from torch.testing._internal.common_utils import IS_FBCODE, IS_MACOS, IS_SANDCASTLE, IS_WINDOWS, find_library_location
  from torch.testing import FileCheck
label_desc: Use image node_id 2 for calling the TestTorchbind obj's underlying member method code with example usage: obj.test_torchbind() and returns: cmp_key,  cmp_key, val, ss, unknown, self,  self, CustomWrapper