-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Deduplicate legacy _ctor and _new Python bindings #73822
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
I guess hypothetically the logic duplication here is a faux amis because we could say that the constructor and new method should evolve APIs independently... but nah, it's not worth it. There is only very slight differences between the two functions: different error messages, and the new method does extra checks to make sure the requested types are consistent with the base Tensor. But I need to refactor this code and I really don't want to do the refactor twice. So dedupe first. Signed-off-by: Edward Z. Yang <[email protected]> [ghstack-poisoned]
CI Flow Status⚛️ CI FlowRuleset - Version:
|
🔗 Helpful links
💊 CI failures summary and remediationsAs of commit 3f5a7ed (more details on the Dr. CI page): 💚 💚 Looks good so far! There are no failures yet. 💚 💚 This comment was automatically generated by Dr. CI (expand for details).Please report bugs/suggestions to the (internal) Dr. CI Users group. |
I guess hypothetically the logic duplication here is a faux amis because we could say that the constructor and new method should evolve APIs independently... but nah, it's not worth it. There is only very slight differences between the two functions: different error messages, and the new method does extra checks to make sure the requested types are consistent with the base Tensor. But I need to refactor this code and I really don't want to do the refactor twice. So dedupe first. Signed-off-by: Edward Z. Yang <ezyangfb.com> ghstack-source-id: c4afe59 Pull Request resolved: #73822
|
@ezyang has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
| throw std::runtime_error("new(): invalid arguments"); | ||
| } | ||
|
|
||
| Tensor legacy_tensor_new(c10::DispatchKey dispatch_key, at::ScalarType scalar_type, PyObject* args, PyObject* kwargs) { |
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.
didn't even know this existed haha
|
@pytorchbot merge this |
|
Merge failed due to PR 73822 does not match merge rules |
Summary: Pull Request resolved: #73822 I guess hypothetically the logic duplication here is a faux amis because we could say that the constructor and new method should evolve APIs independently... but nah, it's not worth it. There is only very slight differences between the two functions: different error messages, and the new method does extra checks to make sure the requested types are consistent with the base Tensor. But I need to refactor this code and I really don't want to do the refactor twice. So dedupe first. Signed-off-by: Edward Z. Yang <[email protected]> Test Plan: Imported from OSS Reviewed By: anjali411 Differential Revision: D34665171 Pulled By: ezyang fbshipit-source-id: bd40ec7f6e694bfeff4e4aaab2f4e95cea250b65
|
Hey @ezyang. |
Summary: Pull Request resolved: pytorch/pytorch#73822 I guess hypothetically the logic duplication here is a faux amis because we could say that the constructor and new method should evolve APIs independently... but nah, it's not worth it. There is only very slight differences between the two functions: different error messages, and the new method does extra checks to make sure the requested types are consistent with the base Tensor. But I need to refactor this code and I really don't want to do the refactor twice. So dedupe first. Signed-off-by: Edward Z. Yang <[email protected]> Test Plan: Imported from OSS Reviewed By: anjali411 Differential Revision: D34665171 Pulled By: ezyang fbshipit-source-id: bd40ec7f6e694bfeff4e4aaab2f4e95cea250b65 (cherry picked from commit 10a03926d8d8f36506c9a3d62cf2c380f559b00b)
Summary: Pull Request resolved: pytorch/pytorch#73822 I guess hypothetically the logic duplication here is a faux amis because we could say that the constructor and new method should evolve APIs independently... but nah, it's not worth it. There is only very slight differences between the two functions: different error messages, and the new method does extra checks to make sure the requested types are consistent with the base Tensor. But I need to refactor this code and I really don't want to do the refactor twice. So dedupe first. Signed-off-by: Edward Z. Yang <[email protected]> Test Plan: Imported from OSS Reviewed By: anjali411 Differential Revision: D34665171 Pulled By: ezyang fbshipit-source-id: bd40ec7f6e694bfeff4e4aaab2f4e95cea250b65 (cherry picked from commit 10a03926d8d8f36506c9a3d62cf2c380f559b00b)
Stack from ghstack (oldest at bottom):
I guess hypothetically the logic duplication here is a faux
amis because we could say that the constructor and new method
should evolve APIs independently... but nah, it's not worth it.
There is only very slight differences between the two functions:
different error messages, and the new method does extra checks
to make sure the requested types are consistent with the base
Tensor. But I need to refactor this code and I really don't want
to do the refactor twice. So dedupe first.
Signed-off-by: Edward Z. Yang [email protected]
Differential Revision: D34665171