Quantcast
Channel: Proper way to do gradient clipping?
Viewing all articles
Browse latest Browse all 22

Proper way to do gradient clipping?

$
0
0

for people trying to just get an answer quickly:

torch.nn.utils.clip_grad_norm(mdl_sgd.parameters(),clip)

or with in-place clamp:

W.grad.data.clamp_(-clip,clip)

also similar Q:

Read full topic


Viewing all articles
Browse latest Browse all 22

Trending Articles