Solved by Anshumaan_Dash in post #4 
              
              
                Try using pred_out, pred_index = torch.max(pred, 1) 
Also, try wrapping your inference code with the wrapper: with torch.no_grad():