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
apex
Commits
dd05dbdb
Commit
dd05dbdb
authored
Apr 30, 2018
by
Michael Carilli
Browse files
properly overriding __getstate__ and __setstate__
parent
7ce2e04f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
apex/fp16_utils/fp16_optimizer.py
apex/fp16_utils/fp16_optimizer.py
+4
-4
No files found.
apex/fp16_utils/fp16_optimizer.py
View file @
dd05dbdb
...
...
@@ -138,8 +138,8 @@ class FP16_Optimizer(object):
the loss scale is not recommended.
**Multi_GPU training**: If the wrapped ``init_optimizer`` was created from a model wrapped in
Pytorch DistributedDataParallel, :class:`FP16_Optimizer`
should still work as
intended.
Pytorch
DistributedDataParallel or Apex
DistributedDataParallel, :class:`FP16_Optimizer`
should still work as
intended.
"""
def
__init__
(
self
,
...
...
@@ -198,10 +198,10 @@ class FP16_Optimizer(object):
self
.
overflow
=
False
self
.
first_closure_call_this_step
=
True
def
__getstate__
def
__getstate__
(
self
):
raise
RuntimeError
(
"FP16_Optimizer should be serialized using state_dict()."
)
def
__setstate__
def
__setstate__
(
self
,
state
):
raise
RuntimeError
(
"FP16_Optimizer should be deserialized using load_state_dict()."
)
def
zero_grad
(
self
):
...
...
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