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
f5be29b2
Unverified
Commit
f5be29b2
authored
Jun 09, 2020
by
Harry
Committed by
GitHub
Jun 09, 2020
Browse files
fix: fix constructor docstring (#328)
parent
821b3ad6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
mmcv/runner/optimizer/default_constructor.py
mmcv/runner/optimizer/default_constructor.py
+6
-1
No files found.
mmcv/runner/optimizer/default_constructor.py
View file @
f5be29b2
...
@@ -10,6 +10,7 @@ from .builder import OPTIMIZER_BUILDERS, OPTIMIZERS
...
@@ -10,6 +10,7 @@ from .builder import OPTIMIZER_BUILDERS, OPTIMIZERS
@
OPTIMIZER_BUILDERS
.
register_module
()
@
OPTIMIZER_BUILDERS
.
register_module
()
class
DefaultOptimizerConstructor
(
object
):
class
DefaultOptimizerConstructor
(
object
):
"""Default constructor for optimizers.
"""Default constructor for optimizers.
By default each parameter share the same optimizer settings, and we
By default each parameter share the same optimizer settings, and we
provide an argument ``paramwise_cfg`` to specify parameter-wise settings.
provide an argument ``paramwise_cfg`` to specify parameter-wise settings.
It is a dict and may contain the following fields:
It is a dict and may contain the following fields:
...
@@ -26,7 +27,8 @@ class DefaultOptimizerConstructor(object):
...
@@ -26,7 +27,8 @@ class DefaultOptimizerConstructor(object):
decay for all weight and bias parameters of depthwise conv
decay for all weight and bias parameters of depthwise conv
layers.
layers.
- ``bypass_duplicate`` (bool): If true, the duplicate parameters
- ``bypass_duplicate`` (bool): If true, the duplicate parameters
would not be added into optimizer. Default: False
would not be added into optimizer. Default: False.
Args:
Args:
model (:obj:`nn.Module`): The model with parameters to be optimized.
model (:obj:`nn.Module`): The model with parameters to be optimized.
optimizer_cfg (dict): The config dict of the optimizer.
optimizer_cfg (dict): The config dict of the optimizer.
...
@@ -36,6 +38,7 @@ class DefaultOptimizerConstructor(object):
...
@@ -36,6 +38,7 @@ class DefaultOptimizerConstructor(object):
- any arguments of the corresponding optimizer type, e.g.,
- any arguments of the corresponding optimizer type, e.g.,
lr, weight_decay, momentum, etc.
lr, weight_decay, momentum, etc.
paramwise_cfg (dict, optional): Parameter-wise options.
paramwise_cfg (dict, optional): Parameter-wise options.
Example:
Example:
>>> model = torch.nn.modules.Conv1d(1, 1, 1)
>>> model = torch.nn.modules.Conv1d(1, 1, 1)
>>> optimizer_cfg = dict(type='SGD', lr=0.01, momentum=0.9,
>>> optimizer_cfg = dict(type='SGD', lr=0.01, momentum=0.9,
...
@@ -79,8 +82,10 @@ class DefaultOptimizerConstructor(object):
...
@@ -79,8 +82,10 @@ class DefaultOptimizerConstructor(object):
def
add_params
(
self
,
params
,
module
,
prefix
=
''
):
def
add_params
(
self
,
params
,
module
,
prefix
=
''
):
"""Add all parameters of module to the params list.
"""Add all parameters of module to the params list.
The parameters of the given module will be added to the list of param
The parameters of the given module will be added to the list of param
groups, with specific rules defined by paramwise_cfg.
groups, with specific rules defined by paramwise_cfg.
Args:
Args:
params (list[dict]): A list of param groups, it will be modified
params (list[dict]): A list of param groups, it will be modified
in place.
in place.
...
...
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