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
wangsen
paddle_dbnet
Commits
e2d6d6c8
Unverified
Commit
e2d6d6c8
authored
Jul 16, 2020
by
dyning
Committed by
GitHub
Jul 16, 2020
Browse files
Merge pull request #350 from littletomatodonkey/add_l2_decay_int
add l2 decay interface
parents
41f5cec5
66cf80fe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
0 deletions
+5
-0
ppocr/optimizer.py
ppocr/optimizer.py
+5
-0
No files found.
ppocr/optimizer.py
View file @
e2d6d6c8
...
...
@@ -15,6 +15,8 @@ from __future__ import absolute_import
from
__future__
import
division
from
__future__
import
print_function
import
paddle.fluid
as
fluid
from
paddle.fluid.regularizer
import
L2Decay
from
ppocr.utils.utility
import
initial_logger
logger
=
initial_logger
()
...
...
@@ -31,6 +33,8 @@ def AdamDecay(params, parameter_list=None):
base_lr
=
params
[
'base_lr'
]
beta1
=
params
[
'beta1'
]
beta2
=
params
[
'beta2'
]
l2_decay
=
params
.
get
(
"l2_decay"
,
0.0
)
if
'decay'
in
params
:
params
=
params
[
'decay'
]
decay_mode
=
params
[
'function'
]
...
...
@@ -47,5 +51,6 @@ def AdamDecay(params, parameter_list=None):
learning_rate
=
base_lr
,
beta1
=
beta1
,
beta2
=
beta2
,
regularization
=
L2Decay
(
regularization_coeff
=
l2_decay
),
parameter_list
=
parameter_list
)
return
optimizer
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