Your input data should be transposed.
According to the basic matrix multiplication: (A, B) x (B, C) = (A, C)
for idx, (data, expected) in enumerate(loader):
    data = data.transpose(1, 0)
    predicted = model(data.to(device))