-
Notifications
You must be signed in to change notification settings - Fork 27.7k
View/Reinterpret Tensor as a different type w/o copying #42571
Copy link
Copy link
Closed
Labels
function requestA request for a new function or the addition of new arguments/modes to an existing function.A request for a new function or the addition of new arguments/modes to an existing function.module: numpyRelated to numpy support, and also numpy compatibility of our operatorsRelated to numpy support, and also numpy compatibility of our operatorstriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module
Metadata
Metadata
Assignees
Labels
function requestA request for a new function or the addition of new arguments/modes to an existing function.A request for a new function or the addition of new arguments/modes to an existing function.module: numpyRelated to numpy support, and also numpy compatibility of our operatorsRelated to numpy support, and also numpy compatibility of our operatorstriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module
🚀 Feature
It would be useful to have a way to reinterpret the type of existing data as another type (without copying). For example, one can do this with NumPy (or CuPy) like so...
Motivation
In some cases users may feed data into PyTorch, which comes from more raw formats (like
bytesandbytearray). So they don't really have the type factored in when provided. In these cases what's needed is a way to add the type after the fact.Pitch
Ideally
Tensorwould get a new method, which allows users to reinterpret the type of data and returns aTensorviewing the same data, but with a different type.Alternatives
Suggestions welcome 🙂
Additional context
NA
Have searched the issue tracker and the discussion forum, but didn't come across anything that looked related. Though please let me know if I've merely overlooked something.
cc @mruberry @rgommers