code: def test_optional_conversion(self):
      @torch.jit.script
      def other_fn(x=None):
          # type: (Optional[int]) -> int
          return torch.jit._unwrap_optional(x)
  
      @torch.jit.script
      def fn(x):
          # type: (int) -> int
          return other_fn(x)
  
      self.assertEqual(fn(2), 2)
  
      @torch.jit.script
      def unify_to_optional(x):
          # type: (bool) -> Optional[int]
          if x:
              a = None
          else:
              a = 2
          return a
  
      self.assertEqual(unify_to_optional(True), None)
      self.assertEqual(unify_to_optional(False), 2)
  
      @torch.jit.script
      def opt_list(x):
          # type: (Optional[List[float]]) -> int
          return 2
  
      @torch.jit.script
      def broadcast_opt_list(x):
          # type: (Optional[BroadcastingList2[float]]) -> int
          return 2
  
      @torch.jit.script
      def opt_list_tuple_caller(x):
          # type: (Tuple[float, float]) -> int
          return opt_list(x) + broadcast_opt_list(x)
  
      self.assertEqual(opt_list_tuple_caller((2.0, 3.0)), 4)
  
imports: import os
  import sys
  import torch
  from torch.testing._internal.jit_utils import JitTestCase, make_global
  from torch.testing._internal.common_utils import IS_WINDOWS
  from collections import namedtuple
  from typing import List, Tuple, Dict, NamedTuple
label_desc: Use image node_id 34 for calling the TestTyping obj's underlying member method code with example usage: obj.test_optional_conversion() and returns: torch, other_fn, a, int, int, unknown