Skip to content
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

Deprecation warning in Tensor.storage() should suggest alternate API #89224

Closed
kurtamohler opened this issue Nov 17, 2022 · 2 comments
Closed
Assignees
Labels
module: deprecation module: python frontend For issues relating to PyTorch's Python frontend triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Comments

@kurtamohler
Copy link
Collaborator

kurtamohler commented Nov 17, 2022

Since #85303 deprecated TypedStorage, calling Tensor.storage() now raises a warning about the deprecation because it returns a TypedStorage. The warning should be updated to mention how to get an UntypedStorage from the tensor. At the moment, this is done with Tensor._storage(), but it should be renamed to Tensor.untyped_storage() so that it's public, and there should be documentation for it.

It might be good for the warning to mention in which cases UntypedStorage and TypedStorage are not interchangeable.

We should also have a function that takes an UntypedStorage and a torch.dtype and returns a tensor that wraps the storage. EDIT: torch.tensor does this

cc @albanD

@kurtamohler kurtamohler self-assigned this Nov 17, 2022
@kurtamohler kurtamohler added the module: python frontend For issues relating to PyTorch's Python frontend label Nov 17, 2022
@soulitzer soulitzer added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Nov 18, 2022
@albanD
Copy link
Collaborator

albanD commented Nov 22, 2022

That sounds good. The new untyped_storage API sounds good.
Not sure if we really need an API to build a Storage again? The APIs that we have today that take Storage also accept UntypedStorages right?

It would be good as well to provide 1-1 correspondance for python storage object with c++ storage like we do for Tensor. @ezyang do you think it is worth reproducing all the complexity we have for Tensor here?

@ezyang
Copy link
Contributor

ezyang commented Nov 23, 2022

@eellison has been asking for it and I think is reasonable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: deprecation module: python frontend For issues relating to PyTorch's Python frontend triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants