-
Notifications
You must be signed in to change notification settings - Fork 25.7k
[fx] Add a faster method for inserting positional argument. #111974
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/111974
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 307b644 with merge base b54ab57 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
This pull request was exported from Phabricator. Differential Revision: D50574435 |
e26e348 to
cab2e31
Compare
|
This pull request was exported from Phabricator. Differential Revision: D50574435 |
1 similar comment
|
This pull request was exported from Phabricator. Differential Revision: D50574435 |
eef0ecc to
c38742b
Compare
|
This pull request was exported from Phabricator. Differential Revision: D50574435 |
c38742b to
d59bc2e
Compare
|
This pull request was exported from Phabricator. Differential Revision: D50574435 |
d59bc2e to
85ca98f
Compare
|
This pull request was exported from Phabricator. Differential Revision: D50574435 |
…111974) Summary: Traditionally when user want to update the arguments for an FX node, the only way is to call the setter of .args property on nodes. This may be problematic when we insert a lot of arguments. Because of the semantics of the setter method, it has a worst case O(n) complexity. Adding a new insert_arg provides us two benefits: 1. The operation is guaranteed to be O(1) cost. 2. User can express the intentation more directly, instead of writing code like `node.args = (arg,) + node.args` Test Plan: caffe2/test:fx -- -r test_insert_arg Reviewed By: suo Differential Revision: D50574435
85ca98f to
307b644
Compare
|
This pull request was exported from Phabricator. Differential Revision: D50574435 |
|
@pytorchbot merge (Initiating merge automatically since Phabricator Diff has merged) |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
…111974) Summary: Traditionally when user want to update the arguments for an FX node, the only way is to call the setter of .args property on nodes. This may be problematic when we insert a lot of arguments. Because of the semantics of the setter method, it has a worst case O(n) complexity. Adding a new insert_arg provides us two benefits: 1. The operation is guaranteed to be O(1) cost. 2. User can express the intentation more directly, instead of writing code like `node.args = (arg,) + node.args` Test Plan: caffe2/test:fx -- -r test_insert_arg Reviewed By: suo Differential Revision: D50574435 Pull Request resolved: pytorch#111974 Approved by: https://github.com/angelayi
…111974) Summary: Traditionally when user want to update the arguments for an FX node, the only way is to call the setter of .args property on nodes. This may be problematic when we insert a lot of arguments. Because of the semantics of the setter method, it has a worst case O(n) complexity. Adding a new insert_arg provides us two benefits: 1. The operation is guaranteed to be O(1) cost. 2. User can express the intentation more directly, instead of writing code like `node.args = (arg,) + node.args` Test Plan: caffe2/test:fx -- -r test_insert_arg Reviewed By: suo Differential Revision: D50574435 Pull Request resolved: pytorch#111974 Approved by: https://github.com/angelayi
Summary:
Traditionally when user want to update the arguments for an FX node, the only way is to call the setter of .args property on nodes. This may be problematic when we insert a lot of arguments. Because of the semantics of the setter method, it has a worst case O(n) complexity.
Adding a new insert_arg provides us two benefits:
node.args = (arg,) + node.argsTest Plan: caffe2/test:fx -- -r test_insert_arg
Reviewed By: suo
Differential Revision: D50574435