Skip to content

StorageImpl scalar_type_ to data_type_#10915

Closed
cpuhrsch wants to merge 3 commits intopytorch:masterfrom
cpuhrsch:std
Closed

StorageImpl scalar_type_ to data_type_#10915
cpuhrsch wants to merge 3 commits intopytorch:masterfrom
cpuhrsch:std

Conversation

@cpuhrsch
Copy link
Contributor

No description provided.

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.

size,
allocator->allocate(at::elementSize(scalar_type) * size),
allocator->allocate(
at::elementSize(dataTypeToScalarType(data_type)) * size),

This comment was marked as off-topic.

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.


size_t elementSize() const {
return at::elementSize(scalar_type_);
return at::elementSize(dataTypeToScalarType(data_type_));

This comment was marked as off-topic.

Copy link
Contributor

@ezyang ezyang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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.

This comment was marked as off-topic.

This comment was marked as off-topic.

@cpuhrsch cpuhrsch changed the title [WIP] StorageImpl scalar_type_ to data_type_ StorageImpl scalar_type_ to data_type_ Aug 28, 2018
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cpuhrsch has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

zdevito pushed a commit to zdevito/ATen that referenced this pull request Aug 28, 2018
Summary: Pull Request resolved: pytorch/pytorch#10915

Reviewed By: ezyang

Differential Revision: D9526416

Pulled By: cpuhrsch

fbshipit-source-id: 68e43121d72b1b951c73df5bf7b598854fb0e291
PenghuiCheng pushed a commit to PenghuiCheng/pytorch that referenced this pull request Sep 11, 2018
Summary: Pull Request resolved: pytorch#10915

Reviewed By: ezyang

Differential Revision: D9526416

Pulled By: cpuhrsch

fbshipit-source-id: 68e43121d72b1b951c73df5bf7b598854fb0e291
@ezyang ezyang added the merged label Jun 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants