What is the application scenario for torch.Storage? When should I use it? I began to learn pytorch
Hi,
torch.Storage
is the data structure that is underlying a torch.Tensor
.
You can see the storage as a 1D array of data in memory, and a tensor as a fancy multidimensional way to see this memory and use it.
If you are using pytorch for neural networks, you should not need to use them directly.
Thank you. It can only be a 1 D array?
for example: Torch.FloatStorage (3)
Hi,
Yes, anything more complex than a 1D array needs to work with Tensors.
Thank you.
How do you change a 1D array Tensor to Storage?
Tensors have a .storage()
method that returns the underlying storage.
Thank you.
I probably know. What’s the advanced usage of it?
There is not really a advance usage of it, it’s one of the layer on how to have very generic tensors.
It can allow to share the same storage for multiple tensors for example. Or handle some operations more efficiently.
I see. Thank you very much