Issue
Is there any way, I can add simple L1/L2 regularization in PyTorch? We can probably compute the regularized loss by simply adding the data_loss
with the reg_loss
but is there any explicit way, any support from PyTorch library to do it more easily without doing it manually?
Solution
This is presented in the documentation for PyTorch. You can add L2 loss using the weight_decay
parameter to the Optimization function.
Answered By - Kashyap
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.