StorageImpl scalar_type_ to data_type_#10915
StorageImpl scalar_type_ to data_type_#10915cpuhrsch wants to merge 3 commits intopytorch:masterfrom
Conversation
aten/src/ATen/Storage.h
Outdated
| bool resizable() const { return storage_impl_->resizable(); } | ||
| // get() use here is to get const-correctness | ||
| void* data() const { return storage_impl_.get()->data(); } | ||
| const at::DataType& dtype() const { |
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.
| size, | ||
| allocator->allocate(at::elementSize(scalar_type) * size), | ||
| allocator->allocate( | ||
| at::elementSize(dataTypeToScalarType(data_type)) * size), |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
| auto scalar_type_T = at::CTypeToScalarType<th::from_type<T>>::to(); | ||
| if (scalar_type_ != scalar_type_T) { | ||
| auto data_type_T = | ||
| at::scalarTypeToDataType(at::CTypeToScalarType<th::from_type<T>>::to()); |
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.
|
|
||
| size_t elementSize() const { | ||
| return at::elementSize(scalar_type_); | ||
| return at::elementSize(dataTypeToScalarType(data_type_)); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
ezyang
left a comment
There was a problem hiding this comment.
It's a good start. We'll need to get rid of many of the conversions back to ScalarType once DataType-TypeMeta registry lands, but at least now they're easy to grep for.
aten/src/ATen/StorageImpl.h
Outdated
| at::ScalarType scalar_type() const { | ||
| return scalar_type_; | ||
| }; | ||
| const DataType& dtype() const { |
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.
facebook-github-bot
left a comment
There was a problem hiding this comment.
cpuhrsch has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Summary: Pull Request resolved: pytorch/pytorch#10915 Reviewed By: ezyang Differential Revision: D9526416 Pulled By: cpuhrsch fbshipit-source-id: 68e43121d72b1b951c73df5bf7b598854fb0e291
Summary: Pull Request resolved: pytorch#10915 Reviewed By: ezyang Differential Revision: D9526416 Pulled By: cpuhrsch fbshipit-source-id: 68e43121d72b1b951c73df5bf7b598854fb0e291
No description provided.