[FX] Enforce args is tuple and kwargs is dict (#49526)

Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/49526

Test Plan: Imported from OSS

Reviewed By: Chillee

Differential Revision: D25606115

Pulled By: jamesr66a

fbshipit-source-id: f2a21d02a2cf8c08cbd618efc5a6a28d34806851
diff --git a/torch/fx/experimental/subgraph_creation_example.py b/torch/fx/experimental/subgraph_creation_example.py
index e3aabd6..daca84a 100644
--- a/torch/fx/experimental/subgraph_creation_example.py
+++ b/torch/fx/experimental/subgraph_creation_example.py
@@ -161,7 +161,7 @@
 
         # Emit call in base graph to this submodule
 
-        output_val = base_mod_graph.call_module(submod_name, [base_mod_env[name] for name in partition.inputs])  # type: ignore
+        output_val = base_mod_graph.call_module(submod_name, tuple(base_mod_env[name] for name in partition.inputs))  # type: ignore
         if len(partition.outputs) > 1:
             # Unpack multiple return values from submodule
             output_val_proxy = torch.fx.proxy.Proxy(output_val)  # type: ignore
diff --git a/torch/fx/graph.py b/torch/fx/graph.py
index e38e283..86e78f2 100644
--- a/torch/fx/graph.py
+++ b/torch/fx/graph.py
@@ -247,6 +247,8 @@
         assert op in ('call_function', 'call_method', 'get_attr', 'call_module', 'placeholder', 'output')
         args = () if args is None else args
         kwargs = {} if kwargs is None else kwargs
+        assert isinstance(args, tuple), "args must be a tuple"
+        assert isinstance(kwargs, dict), "kwargs must be a dict"
         unique_name = self._create_unique_name(name if name is not None else self._target_to_str(target))
         n = Node(self, unique_name, op, target, args, kwargs, type_expr)
         self._insert(n)