PyTorch Internals

PyTorch Internals

We can think of a tensor as consisting of some data, and then some metadata describing the size of the tensor, the type of the elements in contains (dtype), what device the tensor lives on (CPU memory? First, there is the trinity three parameters which uniquely determine what a tensor is:

If you want to add an extension to PyTorch tensors (by the way, if that’s what you want to do, please talk to us! There’s one last way you can make an “extension” to Tensor functionality, and that’s write a wrapper class around PyTorch tensors that implements your object type.

Source: blog.ezyang.com