Remove methods that start with an underscore from at::Tensor#11152
Remove methods that start with an underscore from at::Tensor#11152goldsborough wants to merge 12 commits intopytorch:masterfrom
Conversation
torch/optim/sparse_adam.py
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
eb24083 to
aa3ff2d
Compare
|
Ok so I:
I think this should make everyone happy @zou3519 @ssnl @weiyangfb? |
aa3ff2d to
d1c49e4
Compare
No, please don't do this. I'll quote the current sparse documentation:
|
|
@goldsborough Is your goal to unconditionally remove all underscore-prefixed methods from Tensor, or are you OK with exceptions? |
|
@ezyang I'm ok with exceptions, I just thought we might as well fix the API since public underscore fields seem wrong either way. But maybe that's a discussion for another PR. I'll leave them be in this one :) |
af9b4e9 to
f5ca400
Compare
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
torch/_tensor_str.py
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
There was a problem hiding this comment.
I just realized this is going to intersect with #11247 ; both diffs de-method-ize some functions where methods don't make sense (but yours is more aggressive) (I didn't realize this because the latter diff is doing something else: changing interpretation of missing variants in native). Do you want to fold that patch in, or should I just rebase on top? Or should I land mine first?
|
Test failures are real... |
e4f3ee0 to
f62dad6
Compare
f62dad6 to
570efe9
Compare
facebook-github-bot
left a comment
There was a problem hiding this comment.
goldsborough is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Summary: This PR cleans up the `at::Tensor` class by removing all methods that start with an underscore in favor of functions in the `at::` namespace. This greatly cleans up the `Tensor` class and makes it clearer what is the public and non-public API. For this I changed `native_functions.yaml` and `Declarations.cwrap` to make all underscore methods `variant: function` (or add such a statement to begin with), and then fixed all code locations using the underscore methods. ezyang colesbury gchanan Pull Request resolved: pytorch/pytorch#11152 Differential Revision: D9683607 Pulled By: goldsborough fbshipit-source-id: 97f869f788fa56639c05a439e2a33be49f10f543
…#11152) Summary: This PR cleans up the `at::Tensor` class by removing all methods that start with an underscore in favor of functions in the `at::` namespace. This greatly cleans up the `Tensor` class and makes it clearer what is the public and non-public API. For this I changed `native_functions.yaml` and `Declarations.cwrap` to make all underscore methods `variant: function` (or add such a statement to begin with), and then fixed all code locations using the underscore methods. ezyang colesbury gchanan Pull Request resolved: pytorch#11152 Differential Revision: D9683607 Pulled By: goldsborough fbshipit-source-id: 97f869f788fa56639c05a439e2a33be49f10f543
This PR cleans up the
at::Tensorclass by removing all methods that start with an underscore in favor of functions in theat::namespace. This greatly cleans up theTensorclass and makes it clearer what is the public and non-public API.For this I changed
native_functions.yamlandDeclarations.cwrapto make all underscore methodsvariant: function(or add such a statement to begin with), and then fixed all code locations using the underscore methods.@ezyang @colesbury @gchanan