-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Add some named tensor helper functions #21636
Conversation
at::internal_set_names_inplace(Tensor, optional<DimnameList>) - Used for setting the names of a tensor. This isn't a native function for performance reasons; it'll be used to implement tensor.set_names_, torch.empty(..., names=), and other functions. optional<DimnameList> Tensor::names() - Access names of a tensor. Test Plan: - New tests in [namedtensor ci]
@nairbv can you take a look? |
@@ -257,6 +267,7 @@ class CAFFE2_API Tensor { | |||
|
|||
/// Returns a `Tensor`'s dimension names data structure | |||
NamedTensorMeta* get_named_tensor_meta() const; | |||
NamedTensorMeta* get_named_tensor_meta(); |
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.
c++ question .... why don't these function signatures conflict?
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.
c++ lets you overload member methods based on const-ness.
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.
Err I'm changing the signatures to const NamedTensorMeta* get_named_tensor_meta() const;
. I am not sure if this is actually different.
Add some named tensor helper functions at::internal_set_names_inplace(Tensor, optional<DimnameList>) - Used for setting the names of a tensor. This isn't a native function for performance reasons; it'll be used to implement tensor.set_names_, torch.empty(..., names=), and other functions. optional<DimnameList> Tensor::names() - Access names of a tensor. Test Plan: - New tests in [namedtensor ci] gh-metadata: pytorch pytorch 21636 gh/zou3519/46/head
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.
Tensor &
Add some named tensor helper functions at::internal_set_names_inplace(Tensor, optional<DimnameList>) - Used for setting the names of a tensor. This isn't a native function for performance reasons; it'll be used to implement tensor.set_names_, torch.empty(..., names=), and other functions. optional<DimnameList> Tensor::names() - Access names of a tensor. Test Plan: - New tests in [namedtensor ci] gh-metadata: pytorch pytorch 21636 gh/zou3519/46/head
@nairbv updated |
Summary: Pull Request resolved: pytorch/pytorch#21636 ghimport-source-id: 5eff5744cd3c80f75bdb02576be1407a64e0434d Differential Revision: D15780269 Pulled By: zou3519 fbshipit-source-id: 87ff40ffbe0ebd5fc4d105709c9f6f8dda5f9952
Stack from ghstack:
at::internal_set_names_inplace(Tensor, optional)
performance reasons; it'll be used to implement tensor.set_names_,
torch.empty(..., names=), and other functions.
optional Tensor::names()
Test Plan:
gh-metadata: pytorch pytorch 21636 gh/zou3519/46/head
Differential Revision: D15780269