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.
1 parent c48008b commit a16173fCopy full SHA for a16173f
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