-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement the experimental evaluator for folding branches and castlik…
…es | feat(torchlib) (#1178) Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom): * __->__ #1178 As an effort described in #1095, this PR - Implements the experimental evaluator for folding branches and castlikes so that they are eagerly evaluated when possible. - Updates implementation for `addr` for it to be traceable. - Conditionally enabled previously xfailed tests. Set `TORCHLIB_EXPERIMENTAL_PREFER_TRACING=1` and tested in CI. E.g. clamp_min now becomes ``` < ir_version: 8, opset_import: ["" : 18, "pkg.onnxscript.torch_lib.common" : 1], producer_name: "pytorch", producer_version: "2.2.0" > main_graph (int32[5,10,5] input_0, int32[10,5] input_1) => (int32[5,10,5] _val_9) <int64 _val_2, int64[2] _val_3, int64 _val_4, int64 _val_5, bool _val_6, int64 _val_7, bool _val_8> { _val_2 = Size (input_0) _val_3 = Shape <start: int = 0> (input_1) _val_4 = Size (_val_3) _val_5 = Constant <value: tensor = int64 {0}> () _val_6 = Equal (_val_2, _val_5) _val_7 = Constant <value: tensor = int64 {0}> () _val_8 = Equal (_val_4, _val_7) _val_9 = Max (input_0, input_1) } < domain: "pkg.onnxscript.torch_lib.common", opset_import: ["" : 18] > Rank (input) => (return_val) { tmp = Shape (input) return_val = Size (tmp) } < domain: "pkg.onnxscript.torch_lib.common", opset_import: ["" : 18] > IsScalar (input) => (return_val) { tmp = Shape (input) tmp_0 = Size (tmp) tmp_1 = Constant <value_int: int = 0> () return_val = Equal (tmp_0, tmp_1) } ```
- Loading branch information
1 parent
744cabd
commit 5ba7efa
Showing
3 changed files
with
63 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