PyTorch Tensor View

Tensors have an associated torch.Storage that holds the data.

While sharing the same storage, tensors can have different shapes and strides.

Table of contents
  1. Reshape vs View

Reshape vs View

Suppose we have a tensor x of shape [6]:

r = x.reshape(2, 3)
v = x.view(2, 3)

References: