Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents c48008b + a16173f commit 4896cefCopy full SHA for 4896cef
tutorials/02-intermediate/language_model/main.py
@@ -3,7 +3,7 @@
3
import torch
4
import torch.nn as nn
5
import numpy as np
6
-from torch.nn.utils import clip_grad_norm
+from torch.nn.utils import clip_grad_norm_
7
from data_utils import Dictionary, Corpus
8
9
@@ -78,7 +78,7 @@ def detach(states):
78
# Backward and optimize
79
model.zero_grad()
80
loss.backward()
81
- clip_grad_norm(model.parameters(), 0.5)
+ clip_grad_norm_(model.parameters(), 0.5)
82
optimizer.step()
83
84
step = (i+1) // seq_length
0 commit comments