Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
MMCV
Commits
3f4c9fd0
"vscode:/vscode.git/clone" did not exist on "193d6300bfa40be659155a50f4f6e226ef6a9553"
Unverified
Commit
3f4c9fd0
authored
Jun 16, 2020
by
Wang Xinjiang
Committed by
GitHub
Jun 16, 2020
Browse files
fix possible bugs brought by dumping grad_norm to the logger in pytorch1.5 (#349)
parent
f28a7c7e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
mmcv/runner/hooks/optimizer.py
mmcv/runner/hooks/optimizer.py
+1
-1
No files found.
mmcv/runner/hooks/optimizer.py
View file @
3f4c9fd0
...
@@ -23,6 +23,6 @@ class OptimizerHook(Hook):
...
@@ -23,6 +23,6 @@ class OptimizerHook(Hook):
grad_norm
=
self
.
clip_grads
(
runner
.
model
.
parameters
())
grad_norm
=
self
.
clip_grads
(
runner
.
model
.
parameters
())
if
grad_norm
is
not
None
:
if
grad_norm
is
not
None
:
# Add grad norm to the logger
# Add grad norm to the logger
runner
.
log_buffer
.
update
({
'grad_norm'
:
grad_norm
},
runner
.
log_buffer
.
update
({
'grad_norm'
:
float
(
grad_norm
)
},
runner
.
outputs
[
'num_samples'
])
runner
.
outputs
[
'num_samples'
])
runner
.
optimizer
.
step
()
runner
.
optimizer
.
step
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment