Are view() in Pytorch and reshape() in Numpy similar? Are view() in torch and reshape() in Numpy similar?

view() is applied on torch tensors to change their shape and reshape() is a numpy function to change shape of ndarrays.
Yes, for most intents and purposes, they can do the same job. From this link, an example:

&gt;&gt;&gt; import torch
&gt;&gt;&gt; t = torch.ones((2, 3, 4))
&gt;&gt;&gt; t.size()
torch.Size([2, 3, 4])
&gt;&gt;&gt; t.view(-1, 12).size()
torch.Size([2, 12])




If you are concerned with memory allocation, here is another answer on StackOverflow with a little more information. PyTorch's view function actually does what the name suggests - returns a view to the data. The data is not altered in memory as far as I can see.

In numpy, the reshape function does not guarantee that a copy of the data is made or not. It will depend on the original shape of the array and the target shape. Have a look here for further information.