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
81aba737
Unverified
Commit
81aba737
authored
May 07, 2021
by
xiaoting
Committed by
GitHub
May 07, 2021
Browse files
[Cherry pick] fix srn for sub_layers (#2694)
* fix srn for sublayer * update for paddle2.1
parent
3ed769d1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
5 deletions
+2
-5
ppocr/modeling/heads/self_attention.py
ppocr/modeling/heads/self_attention.py
+2
-5
No files found.
ppocr/modeling/heads/self_attention.py
View file @
81aba737
...
...
@@ -285,8 +285,7 @@ class PrePostProcessLayer(nn.Layer):
elif
cmd
==
"n"
:
# add layer normalization
self
.
functors
.
append
(
self
.
add_sublayer
(
"layer_norm_%d"
%
len
(
self
.
sublayers
(
include_sublayers
=
False
)),
"layer_norm_%d"
%
len
(
self
.
sublayers
()),
paddle
.
nn
.
LayerNorm
(
normalized_shape
=
d_model
,
weight_attr
=
fluid
.
ParamAttr
(
...
...
@@ -320,9 +319,7 @@ class PrepareEncoder(nn.Layer):
self
.
src_emb_dim
=
src_emb_dim
self
.
src_max_len
=
src_max_len
self
.
emb
=
paddle
.
nn
.
Embedding
(
num_embeddings
=
self
.
src_max_len
,
embedding_dim
=
self
.
src_emb_dim
,
sparse
=
True
)
num_embeddings
=
self
.
src_max_len
,
embedding_dim
=
self
.
src_emb_dim
)
self
.
dropout_rate
=
dropout_rate
def
forward
(
self
,
src_word
,
src_pos
):
...
...
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