Skip to content

Commit 38f1aab

Browse files
angelayifacebook-github-bot
authored andcommitted
Update how we input kwargs
Summary: Previously, the code for passing inputs to exported program was: ``` if kwargs: return (args, kwargs) else: return args ``` However, this causes some inconsistency where if the original input contains args and kwargs, the treespec would be a tuple containing a tuple of arguments, and a dictionary of keyword arguments. But if the original input only contained args, the treespec would just be a tuple of arguments. So I updated the code to just always keep the kwargs around cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx chenyang78 aakhundov kadeng X-link: pytorch/pytorch#109160 Differential Revision: D49218534 Pulled By: angelayi
1 parent fbbec00 commit 38f1aab

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

exir/capture/_capture.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def capture( # noqa: C901
163163
# input spec, but due to some limitations in pytree implementation, it doesn't
164164
# recognize the make_fx graph with torchdynamo input spec. We workaround it
165165
# by getting the input spec directly from user argument.
166-
in_spec = pytree.tree_flatten(args)[1]
166+
in_spec = pytree.tree_flatten((args, {}))[1]
167167

168168
if config.enable_functionalization and not config.enable_aot:
169169
args = copy.deepcopy(args)

0 commit comments

Comments
 (0)