-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Handle custom op during TorchScript to ExportedProgram conversion #127580
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/127580
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 16b840c with merge base 0de6d24 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The custom op changes look good, but I think your PR also includes some changes for when the model has attributes. Can we split those out into a separate PR?
b0e16ca
to
ddc0069
Compare
if target is torch.ops.aten.size.int: | ||
target = torch.ops.aten.sym_size.int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we can add this to the registry in a followup PR
f03cf2a
to
3378bb4
Compare
3378bb4
to
16b840c
Compare
@pytorchbot merge -f "skip stuck tests" |
Merge startedYour change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
…torch#127580) #### Description Handle custom ops during TorchScript to ExportedProgram covnersion ```python torch.library.define( "mylib::foo", "(Tensor x) -> Tensor", lib=lib, ) # PyTorch custorm op implementation @torch.library.impl( "mylib::foo", "CompositeExplicitAutograd", lib=lib, ) def foo_impl(x): return x + x # Meta function of the custom op. @torch.library.impl_abstract( "mylib::foo", lib=lib, ) def foo_meta(x): return x + x class M(torch.nn.Module): def forward(self, x): return torch.ops.mylib.foo(x) ``` #### Test Plan * Add a test case where custom op is called and converted. `pytest test/export/test_converter.py -s -k test_ts2ep_converter_custom_op` Pull Request resolved: pytorch#127580 Approved by: https://github.com/angelayi
Description
Handle custom ops during TorchScript to ExportedProgram covnersion
Test Plan
pytest test/export/test_converter.py -s -k test_ts2ep_converter_custom_op