Hi, @ptrblck !
Thanks for the response, the solution that you give me was great to solve the problem of the endianness, but now the problem is that my tensors do not have the same dimensions, the following error is given to me (with some variations in the ‘‘at entry n’’):
RuntimeError: stack expects each tensor to be equal size, but got [126, 126] at entry 0 and [46, 126] at entry 11
For solve that, I modify the code to this:
def npy_loader(path):
    arr_load = np.load(path)
    arr = np.resize(arr_load, (126, 126))
    arr = arr.astype(np.float32)
    sample = torch.from_numpy(arr)
    return sample

But when I run the code again, the following error emerges:
Expected 4-dimensional input for 4-dimensional weight [6, 3, 5, 5], but got 3-dimensional input of size [64, 126, 126] instead
Well, my next shot was modify again the code of the npy_loader to this:
def npy_loader(path):
    arr_load = np.load(path)
    arr = np.resize(arr_load, (3, 126, 126))
    arr = arr.astype(np.float32)
    sample = torch.from_numpy(arr)
    return sample

Using np.resize(arr_load, (3, 126, 126)) to solve the problem with the three channels in ‘‘weight [6, 3, 5, 5]’’, but again, another error raised:

RuntimeError                              Traceback (most recent call last)
 in ()
10
11         # forward + backward + optimize
—> 12         outputs = net(inputs)
13         loss = criterion(outputs, labels)
14         loss.backward()
4 frames
/usr/local/lib/python3.7/dist-packages/torch/nn/functional.py in linear(input, weight, bias)
1846     if has_torch_function_variadic(input, weight, bias):
1847         return handle_torch_function(linear, (input, weight, bias), input, weight, bias=bias)
 → 1848     return torch._C._nn.linear(input, weight, bias)
1849
1850
RuntimeError: mat1 and mat2 shapes cannot be multiplied (64x12544 and 400x120)
I’m afraid I’m stuck again, your help would be super appreciated, thanks a lot!