forked from pytorch/pytorch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[1/N] Non-Tensor: Scalar Support: Enable aot compile to support aten …
…operations with scalar input like alpha (pytorch#124177) Some operations have a scalar input parameter, like `torch.add(a, b, alpha=2.0)`. Currently, the aot compile does not support such a case because it requires the signature of the captured graph to align with the operation's signature. This means that some inputs in the captured graph may be scalar(float, int, bool, etc.). It breaks the assumption of `compile_fx_aot` as it assumes all the example inputs are tensor - https://github.com/pytorch/pytorch/blob/0f6ce45bcbd7026c00da43db0317ede10830378b/torch/_inductor/compile_fx.py#L1048 This PR intends to support such cases by allowing not-aligned signature and filtering out the non-Tensor parameters. Captured graph for `torch.add(a, b, alpha=2.0)` ``` opcode name target args kwargs ------------- -------- --------------- ---------------- -------------- placeholder arg0_1 arg0_1 () {} placeholder arg1_1 arg1_1 () {} call_function add aten.add.Tensor (arg0_1, arg1_1) {'alpha': 2.0} output output_1 output ((add,),) {} ``` Pull Request resolved: pytorch#124177 Approved by: https://github.com/jansel, https://github.com/desertfire, https://github.com/jgong5
- Loading branch information
1 parent
5fa1f4c
commit 08aa704
Showing
5 changed files
with
30 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters