class_docstr: A suite of tests for profile directed typing in TorchScript.
class_docstr_tok: ["A","suite","of","tests","for","profile","directed","typing","in","TorchScript","."]
code: def test_class_methods(self):
      class PDTModel:
          def test_sum(self, a):
              return sum(a)
  
      make_global(PDTModel)
      pdt_model = PDTModel()
      inp: List[Tuple[Any, ...]] = [
          (
              [
                  10,
                  20,
              ],
          ),
      ]
      scripted_pdt_model = torch.jit.script(
          PDTModel, example_inputs={pdt_model.test_sum: inp}
      )
      script_model = scripted_pdt_model()
      self.assertEqual(
          script_model.test_sum(
              [
                  10,
                  20,
                  30,
              ],
          ),
          pdt_model.test_sum(
              [
                  10,
                  20,
                  30,
              ],
          ),
      )
  
imports: import os
  import sys
  import torch
  from torch.testing._internal.jit_utils import JitTestCase, make_global
  from torch.jit._monkeytype_config import _IS_MONKEYTYPE_INSTALLED
  from typing import List, Dict, Tuple, Any, Optional, NamedTuple
  from torch.testing._internal.common_utils import NoTest
label_desc: Use image node_id 6 for calling the TestPDT obj's underlying member method code with example usage: obj.test_class_methods() and returns: sum