Solved by ptrblck in post #2 
              
              
                reshape is not an inplace operation, so you need to assign the return value to another object: 
xb = xb.reshape(-1, 784)

Generally, I would recommend to use this approach: 
xb = xb.view(xb.size(0), -1)

to keep the batch dimension and to get a better error message in case the feature dimension is i…