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
d1affce6
Commit
d1affce6
authored
Nov 12, 2020
by
WenmuZhou
Browse files
delete fluid
parent
453c6f68
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
6 deletions
+5
-6
ppocr/modeling/heads/rec_ctc_head.py
ppocr/modeling/heads/rec_ctc_head.py
+2
-1
ppocr/optimizer/regularizer.py
ppocr/optimizer/regularizer.py
+3
-5
No files found.
ppocr/modeling/heads/rec_ctc_head.py
View file @
d1affce6
...
...
@@ -24,7 +24,7 @@ from paddle.nn import functional as F
def
get_para_bias_attr
(
l2_decay
,
k
,
name
):
regularizer
=
paddle
.
fluid
.
regularizer
.
L2Decay
(
l2_decay
)
regularizer
=
paddle
.
regularizer
.
L2Decay
(
l2_decay
)
stdv
=
1.0
/
math
.
sqrt
(
k
*
1.0
)
initializer
=
nn
.
initializer
.
Uniform
(
-
stdv
,
stdv
)
weight_attr
=
ParamAttr
(
...
...
@@ -33,6 +33,7 @@ def get_para_bias_attr(l2_decay, k, name):
regularizer
=
regularizer
,
initializer
=
initializer
,
name
=
name
+
"_b_attr"
)
return
[
weight_attr
,
bias_attr
]
class
CTCHead
(
nn
.
Layer
):
def
__init__
(
self
,
in_channels
,
out_channels
,
fc_decay
=
0.0004
,
**
kwargs
):
super
(
CTCHead
,
self
).
__init__
()
...
...
ppocr/optimizer/regularizer.py
View file @
d1affce6
...
...
@@ -17,7 +17,7 @@ from __future__ import division
from
__future__
import
print_function
from
__future__
import
unicode_literals
from
paddle
import
fluid
import
paddle
class
L1Decay
(
object
):
...
...
@@ -32,8 +32,7 @@ class L1Decay(object):
self
.
regularization_coeff
=
factor
def
__call__
(
self
):
reg
=
fluid
.
regularizer
.
L1Decay
(
regularization_coeff
=
self
.
regularization_coeff
)
reg
=
paddle
.
regularizer
.
L1Decay
(
self
.
regularization_coeff
)
return
reg
...
...
@@ -49,6 +48,5 @@ class L2Decay(object):
self
.
regularization_coeff
=
factor
def
__call__
(
self
):
reg
=
fluid
.
regularizer
.
L2Decay
(
regularization_coeff
=
self
.
regularization_coeff
)
reg
=
paddle
.
regularizer
.
L2Decay
(
self
.
regularization_coeff
)
return
reg
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