-
My code is as follow:
|
Beta Was this translation helpful? Give feedback.
Answered by
Prezzo-K
Feb 20, 2025
Replies: 1 comment 3 replies
-
The last Relu activation is messing up with your output. It is not common to use activation function as the last layer. model_v2 = nn.Sequential(
nn.Linear(in_features=2, out_features=10),
nn.ReLU(),
nn.Linear(10, 10),
nn.ReLU(),
nn.Linear(10, 1),
nn.ReLU() # DELETE THIS
) Also add zero out your gradients in the training loop or they will accumulate optimizer.zero_grad() And for better result try out Adam optimizer with lr = 0.1 Hope this answers your questions. |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
s2005lg
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The last Relu activation is messing up with your output. It is not common to use activation function as the last layer.
Also add zero out your gradients in the training loop or they will accumulate
And for better result try out Adam optimizer with lr = 0.1
Hope this answers your questions.