Skip to content

Runtimeerror in train loop. #910

Answered by sametucuncu
GAuravY19 asked this question in Q&A
Discussion options

You must be logged in to vote

The loss is the error between expected output of the model (Y_train) and model's prediction which is y_pred in your case (y_pred = model1(X_train)).

y_pred_act = torch.argmax(torch.sigmoid(y_pred), dim = 1).float() is calculating the label from predicted value of the model. It is not exact output of the model. So, you should use output of the model while calculating the loss. So loss should be:

loss = loss_fn(y_pred, Y_train)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by GAuravY19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants