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_fx_tracing_with_typing(self):
      class FXModelOutput(NamedTuple):
          result: List[int]
  
      class FXModel(torch.nn.Module):
          def forward(self, a) -> FXModelOutput:
              result = FXModelOutput(result=a)
              return result
  
      make_global(FXModel, FXModelOutput)
      pdt_model = FXModel()
      scripted_fn = torch.jit.script(
          pdt_model,
          example_inputs={
              pdt_model: [
                  (
                      [
                          10,
                          20,
                      ],
                  ),
              ],
          },
      )
      self.assertEqual(scripted_fn([20]), pdt_model([20]))
  
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 17 for calling the TestPDT obj's underlying member method code with example usage: obj.test_fx_tracing_with_typing() and returns: result