Skip to content

Conversation

@cpuhrsch
Copy link
Contributor

No description provided.

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.

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.

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.

This comment was marked as off-topic.

@cpuhrsch cpuhrsch force-pushed the cachecont branch 4 times, most recently from de1c620 to da5442f Compare August 23, 2018 19:53
@ezyang
Copy link
Contributor

ezyang commented Aug 23, 2018

The PR is misnamed, it caches numel too

@cpuhrsch cpuhrsch changed the title Cache isContiguous Cache isContiguous and numel Aug 23, 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.

}
void SparseTensorImpl::set_storage_offset(int64_t storage_offset) {
AT_ERROR("sparse tensors does not have set_storage_offset");
}

This comment was marked as off-topic.

protected:
void refresh_numel() {
int64_t n = 1;
for (auto s : sizes()) {

This comment was marked as off-topic.

return numel_;
}

void TensorImpl::refresh_contiguous() {

This comment was marked as off-topic.

for (auto s : sizes()) {
n *= s;
}
AT_ASSERT(n == numel_);

This comment was marked as off-topic.

virtual int64_t numel() const;

virtual bool is_contiguous() const {
return is_contiguous_;

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.

I don't see anything blocking, and since this has a codemod please feel free to merge. But plenty of things to clean up in follow up diffs! (Or if you're unlucky enough to need to rebase, try to roll some of the suggested changes into this patch.)

}

// WARNING: This function does not check if the requested
// sizes/strides are in bounds for the storage is allocated;

This comment was marked as off-topic.

virtual void resize_dim(int64_t ndim) {
// NB: This is *truly* a resize; calling code (e.g., squeeze)
// assumes that old values are preserved
sizes_.resize(ndim);

This comment was marked as off-topic.

This comment was marked as off-topic.

}

void TensorImpl::refresh_contiguous() {
is_contiguous_ = true;

This comment was marked as off-topic.


~Impl() override;

int64_t numel() const override;

This comment was marked as off-topic.

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.

@cpuhrsch
Copy link
Contributor Author

Still have to overwrite is_contiguous() in variable::impl

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.


// WARNING: This function does not check if the requested
// sizes/strides are in bounds for the storage is allocated;
// sizes/strides are in bounds bounds for the storage that is allocated;

This comment was marked as off-topic.

}

bool Variable::Impl::is_contiguous() const {
AT_ERROR("variable impl does not have is_contiguous");

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

AT_ERROR("sparse tensors do not have strides");
}
bool SparseTensorImpl::is_contiguous() const {
AT_ERROR("sparse tensors does not have is_contiguous");

This comment was marked as off-topic.

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 25, 2018
Summary: Pull Request resolved: pytorch/pytorch#10696

Differential Revision: D9437963

Pulled By: cpuhrsch

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

Differential Revision: D9437963

Pulled By: cpuhrsch

fbshipit-source-id: 7217682f5e4b69c73d943411d738e4892bb465f5
@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