Shawn1993/cnn-text-classification-pytorch

l2 norm

dongfang91 opened this issue · 3 comments

Is there any code showing the usage of l2 norm?

Just add the l2 regularization to the optimizer line in train.py

Can you be more specific?
optimizer = torch.optim.Adam(model.parameters(), lr=args.lr)

This line? As an argument?

Already figured it out, it's the weight_decay in optimizer. Thanks!