docstr: Check that saving and loading with traced inputs works as expected
code: def test_save_load_with_saved_traced_inputs(self):
      """
      Check that saving and loading with traced inputs works as expected
      """
  
      class Module(torch.nn.Module):
          def __init__(self):
              super().__init__()
  
          def forward(self, x):
              return torch.ones(1)
  
      def get_loaded_inputs(inputs):
          traced_module = torch.jit.trace(module, input1)
          traced_inputs = list(traced_module.graph.inputs())
          with TemporaryFileName() as fname:
              path = pathlib.Path(fname)
              traced_module.save(path)
              print(traced_module.graph)
              loaded_module = torch.jit.load(path, _restore_shapes=True)
              print(loaded_module.graph)
              return traced_inputs, list(loaded_module.graph.inputs())
  
      module = Module()
      input_tensor = torch.rand(1, 3, 24, 24)
      # Validate that with no input specified the traced inputs are stored
      traced_module = torch.jit.trace(module, input_tensor)
      traced_inputs = list(traced_module.graph.inputs())
      self.assertEqual(
          traced_module._c._retrieve_traced_inputs()["forward"],
          [input_tensor],
      )
      with TemporaryFileName() as fname:
          path = pathlib.Path(fname)
          traced_module.save(path)
          loaded_module = torch.jit.load(path, _restore_shapes=True)
          loaded_inputs = list(loaded_module.graph.inputs())
          self.assertEqual(
              traced_inputs[1].type(), loaded_inputs[1].type()
          )
          self.assertEqual(
              traced_inputs[1].type().sizes(),
              loaded_inputs[1].type().sizes(),
          )
          # Validate that if no shapes are requested previous functionality remains
          loaded_module = torch.jit.load(path)
          loaded_inputs = list(loaded_module.graph.inputs())
          self.assertEqual(loaded_inputs[1].type().sizes(), None)
  
      # Validate that inputs aren't saved when requested not to
      traced_module = torch.jit.trace(
          module, input_tensor, _store_inputs=False
      )
      traced_inputs = list(traced_module.graph.inputs())
      self.assertEqual(
          len(traced_module._c._retrieve_traced_inputs()), 0
      )
  
      with TemporaryFileName() as fname:
          path = pathlib.Path(fname)
          traced_module.save(path)
          loaded_module = torch.jit.load(path, _restore_shapes=True)
          loaded_inputs = list(loaded_module.graph.inputs())
          self.assertEqual(loaded_inputs[1].type().sizes(), None)
          # Validate that if no shapes are requested previous functionality remains
          loaded_module = torch.jit.load(path)
          loaded_inputs = list(loaded_module.graph.inputs())
          self.assertEqual(loaded_inputs[1].type().sizes(), None)
  
      # Validate that complex inputs work
      # Testing dict of list with empty tensors
      input1 = {
          "1000": (
              torch.tensor([0]),
              torch.tensor([], dtype=torch.int64),
              torch.tensor([]),
          )
      }
      traced_inputs, loaded_inputs = get_loaded_inputs(input1)
      self.assertEqual(traced_inputs[1].type(), loaded_inputs[1].type())
  
      # Testing dict of list
      input2 = {
          "1000": (
              torch.tensor([0]),
              torch.tensor([1500000, 1500004], dtype=torch.int64),
              torch.tensor([2.0, 3.0]),
          )
      }
      traced_inputs, loaded_inputs = get_loaded_inputs(input2)
      self.assertEqual(traced_inputs[1].type(), loaded_inputs[1].type())
  
      # Testing list
      input3 = [
          torch.tensor([0]),
          torch.tensor([1500000, 1500004], dtype=torch.int64),
          torch.tensor([2.0, 3.0]),
      ]
  
      traced_inputs, loaded_inputs = get_loaded_inputs(input3)
      self.assertEqual(traced_inputs[1].type(), loaded_inputs[1].type())
  
      # Testing list of dict of list
      input4 = [
          {
              "1000": (
                  torch.tensor([0]),
                  torch.tensor([1500000, 1500004], dtype=torch.int64),
                  torch.tensor([2.0, 3.0]),
              )
          }
      ]
  
      traced_inputs, loaded_inputs = get_loaded_inputs(input4)
      self.assertEqual(traced_inputs[1].type(), loaded_inputs[1].type())
  
imports: import io
  import os
  import pathlib
  import sys
  from typing import NamedTuple, Optional
  import torch
  from torch import Tensor
  from torch.testing._internal.common_utils import TemporaryFileName
  from torch.testing._internal.jit_utils import JitTestCase, clear_class_registry
label_desc: Use image node_id 14 for calling the TestSaveLoad obj's underlying member method code with example usage: obj.test_save_load_with_saved_traced_inputs() and returns: torch, traced_inputs,  list