I want to change an array of size (1,4,4,4,4) to (1,16,16)

I would like to change an array of size (1,4,4,4,4) to (1,16,16).

error contents
view size is not compatible with input tensor’s size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape (…) instead.

Until now, this error only appeared when the size was specified incorrectly in the view

I get a mysterious error (1, 4 * 4, 4 * 4) Then why is it impossible?
4 * 4 = 16 ??? Why do you use reshape (…)?

I forgot to put the cause code
inp.size = (1,16,16)
s = inp.view (1,4,4,4,4) .permute (0,1,3,2,4) .view (1,16,16)

The view operation just changes the tensor metadata without triggering a copy.
After the permute call this won’t be possible anymore as explained in the error message and you would either have to use reshape (which copies the data and performs the view op) or call .contiguous() before the view operation on the tensor.