One way to double check the reshaping operations is to initialize the tensor via torch.arange, reshape it, and print the tensor to see where the values landed. To do so I would reduce the shapes a bit, as the currently used number of elements is quite large.