code: def test_overloaded_fn(self):
      @torch.jit.script
      class Foo:
          def __init__(self, x):
              self.x = x
  
          def __len__(self) -> int:
              return len(self.x)
  
          def __neg__(self):
              self.x = -self.x
              return self
  
          def __mul__(self, other: torch.Tensor) -> torch.Tensor:
              return self.x * other
  
      def test_overload():
          a = Foo(torch.ones([3, 3]))
          return len(a), -a * torch.zeros([3, 3])
  
      make_global(Foo)  # see [local resolution in python]
  
      self.checkScript(test_overload, ())
      # unary ops tested above
  
      # TODO - support compiling classes from strings in jit.CompilationUnit
      @torch.jit.script
      class MyClass:
          def __init__(self, x: int) -> None:
              self.x = x
  
          def __add__(self, other: int) -> int:
              return self.x + other
  
          def __sub__(self, other: int) -> int:
              return self.x - other
  
          def __mul__(self, other: int) -> int:
              return self.x * other
  
          def __pow__(self, other: int) -> int:
              return int(self.x**other)
  
          def __truediv__(self, other: int) -> float:
              return self.x / other
  
          def __mod__(self, other: int) -> int:
              return self.x % other
  
          def __ne__(self, other: int) -> bool:
              return self.x != other
  
          def __eq__(self, other: int) -> bool:
              return self.x == other
  
          def __lt__(self, other: int) -> bool:
              return self.x < other
  
          def __gt__(self, other: int) -> bool:
              return self.x > other
  
          def __le__(self, other: int) -> bool:
              return self.x <= other
  
          def __ge__(self, other: int) -> bool:
              return self.x >= other
  
          def __and__(self, other: int) -> int:
              return self.x & other
  
          def __or__(self, other: int) -> int:
              return self.x | other
  
          def __xor__(self, other: int) -> int:
              return self.x ^ other
  
          def __getitem__(self, other: int) -> int:
              return other + 1
  
          def __setitem__(self, idx: int, val: int) -> None:
              self.x = val * idx
  
          def __call__(self, val: int) -> int:
              return self.x * val * 3
  
      make_global(Foo)  # see [local resolution in python]
  
      def add():
          return MyClass(4) + 3
  
      def sub():  # noqa: E306
          return MyClass(4) - 3
  
      def mul():  # noqa: E306
          return MyClass(4) * 3
  
      def pow():  # noqa: E306
          return MyClass(4) ** 3
  
      def truediv():  # noqa: E306
          return MyClass(4) / 3
  
      def ne():  # noqa: E306
          return MyClass(4) != 3
  
      def eq():  # noqa: E306
          return MyClass(4) == 3
  
      def lt():  # noqa: E306
          return MyClass(4) < 3
  
      def gt():  # noqa: E306
          return MyClass(4) > 3
  
      def le():  # noqa: E306
          return MyClass(4) <= 3
  
      def ge():  # noqa: E306
          return MyClass(4) >= 3
  
      def _and():  # noqa: E306
          return MyClass(4) & 3
  
      def _or():  # noqa: E306
          return MyClass(4) | 3
  
      def _xor():  # noqa: E306
          return MyClass(4) ^ 3
  
      def getitem():  # noqa: E306
          return MyClass(4)[1]
  
      def setitem():  # noqa: E306
          a = MyClass(4)
          a[1] = 5
          return a.x
  
      def call():  # noqa: E306
          a = MyClass(5)
          return a(2)
  
      ops = [
          add,
          sub,
          mul,
          pow,
          ne,
          eq,
          lt,
          gt,
          le,
          ge,
          _and,
          _or,
          _xor,
          getitem,
          setitem,
          call,
      ]
  
      ops.append(truediv)
      for func in ops:
          self.checkScript(func, ())
  
      with self.assertRaisesRegexWithHighlight(
          RuntimeError, "object has no attribute or method", ""
      ):
  
          @torch.jit.script
          def test():
              return Foo(torch.tensor(1)) + Foo(torch.tensor(1))
  
imports: import io
  import os
  import sys
  import unittest
  import torch
  import torch.nn
  from torch.testing import FileCheck
  from typing import Any
  from torch.testing._internal.jit_utils import JitTestCase, make_global
  import torch.testing._internal.jit_utils
  from torch.testing._internal.common_utils import IS_SANDCASTLE, skipIfTorchDynamo
  from typing import List, Tuple, Iterable, Optional, Dict
label_desc: Use image node_id 24 for calling the TestClassType obj's underlying member method code with example usage: obj.test_overloaded_fn() and returns: len,  unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, MyClass, a, a, len, self, unknown, unknown, unknown, unknown, int, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown