When resizing to a larger size, the underlying Storage
must be resized to fit
all the elements of the Tensor
. If the Storage
is not owned by the Tensor
,
then an error "cannot resize a Storage which is not mine" will occur.
When resizing to a smaller size, the underlying Storage
is not resized.
Important note: the content of a Tensor
after resizing is undertermined as strides
might have been completely changed. The elements of the resized tensor are contiguous in memory.