Skip to content

Deprecate tensor.type()#30281

Closed
ngoldbaum wants to merge 25 commits intopytorch:masterfrom
ngoldbaum:deprecate-tensor-type
Closed

Deprecate tensor.type()#30281
ngoldbaum wants to merge 25 commits intopytorch:masterfrom
ngoldbaum:deprecate-tensor-type

Conversation

@ngoldbaum
Copy link
Copy Markdown
Contributor

Fixes #29161.

I looked a bit at the code changes related to this and think I have all of the use cases of DeprecatedTypeProperties covered in the message, but suggestions from someone with more context on this would be very much appreciated :)

@ngoldbaum ngoldbaum requested a review from ezyang November 22, 2019 00:10
@ezyang
Copy link
Copy Markdown
Contributor

ezyang commented Nov 22, 2019

You're gonna need to kill the deprecated sites too.

Nov 22 04:02:12 /opt/conda/lib/python3.6/site-packages/torch/include/torch/csrc/autograd/input_metadata.h: In constructor 'torch::autograd::InputMetadata::InputMetadata(const at::Tensor&)':
Nov 22 04:02:12 /opt/conda/lib/python3.6/site-packages/torch/include/torch/csrc/autograd/input_metadata.h:29:26: error: 'at::DeprecatedTypeProperties& at::Tensor::type() const' is deprecated [-Werror=deprecated-declarations]
Nov 22 04:02:12    : InputMetadata(t.type(), t.sizes(), t.device()) { }

@ngoldbaum
Copy link
Copy Markdown
Contributor Author

I've killed all of the call sites extant in the codebase except for the one I described in my comment on the issue tracking this: #29161 (comment). Any suggestions for how to resolve the issues highlighted there with tensor_flatten.cpp would be very appreciated.

This ended up being a biggish PR. I tried to keep things atomic so it might be easier to review commit-by-commit rather than looking at the whole pull request diff. I'm also happy to upstream this as separate pull requests if that would be easier to review.

@ngoldbaum ngoldbaum force-pushed the deprecate-tensor-type branch from 38ff838 to f092422 Compare November 26, 2019 21:44
@ngoldbaum
Copy link
Copy Markdown
Contributor Author

Hmm, looks like this still needs some work before it's ready for review, seeing test failures locally....

@ngoldbaum ngoldbaum changed the title Deprecate tensor.type() [WIP] Deprecate tensor.type() Nov 26, 2019
@ngoldbaum ngoldbaum force-pushed the deprecate-tensor-type branch from ac8d28e to 9296bda Compare December 2, 2019 21:28
@ezyang
Copy link
Copy Markdown
Contributor

ezyang commented Dec 3, 2019

As an operational matter, it's probably better if we merge this as is, even though you haven't handled the one case you mentioned in your issue. Do you still need to do anything else on this PR before it lands? I see the WIP is still on the PR.

@ngoldbaum
Copy link
Copy Markdown
Contributor Author

I was still trying to get the tests to pass last night, but it looks like the last commit fixed the remaining test failures. This is probably fine to merge as-is. Should we leave in the deprecation message since there's still the sites in tensor_flatten.h and tensor_flatten.cpp that need to be replaced?

@ngoldbaum ngoldbaum changed the title [WIP] Deprecate tensor.type() Deprecate tensor.type() Dec 3, 2019
@ezyang
Copy link
Copy Markdown
Contributor

ezyang commented Dec 4, 2019

Should we leave in the deprecation message since there's still the sites in tensor_flatten.h and tensor_flatten.cpp that need to be replaced?

We can leave it in if it doesn't break anything. One instance of deprecated spew is OK to me for getting the deprecation in earlier.

@ngoldbaum
Copy link
Copy Markdown
Contributor Author

Nope, shouldn't break anything :)

Copy link
Copy Markdown
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.

@ezyang is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@ezyang merged this pull request in f531815.

wuhuikx pushed a commit to wuhuikx/pytorch that referenced this pull request Jan 30, 2020
Summary:
Fixes pytorch#29161.

I looked a bit at the code changes related to this and think I have all of the use cases of `DeprecatedTypeProperties` covered in the message, but suggestions from someone with more context on this would be very much appreciated :)
Pull Request resolved: pytorch#30281

Differential Revision: D18830818

Pulled By: ezyang

fbshipit-source-id: 1a7fcee15354ae09e6644577e7fa33bd26acfe20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[C++] Deprecate Tensor.type() (DeprecatedTypeProperties)

6 participants