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_pdt_dict(self):
      def test_dict(a):
          return a["foo"]
  
      def test_dict_int_list(a):
          return a[1]
  
      make_global(test_dict, test_dict_int_list)
  
      str_bool_inp = {"foo": True, "bar": False}
      scripted_fn = torch.jit.script(
          test_dict, example_inputs=[(str_bool_inp,)]
      )
      self.assertEqual(
          scripted_fn(
              {"foo": False, "bar": True},
          ),
          test_dict(
              {"foo": False, "bar": True},
          ),
      )
  
      str_list_inp = {0: [True, False], 1: [False, True]}
      scripted_fn = torch.jit.script(
          test_dict_int_list, example_inputs=[(str_list_inp,)]
      )
      self.assertEqual(
          scripted_fn(
              {0: [False, False], 1: [True, True]},
          ),
          test_dict_int_list(
              {0: [False, False], 1: [True, True]},
          ),
      )
  
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 12 for calling the TestPDT obj's underlying member method code with example usage: obj.test_pdt_dict() and returns: a, a