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
a094d277
Commit
a094d277
authored
Feb 01, 2021
by
LDOUBLEV
Browse files
opt rec_att_head
parent
0d89f3f9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
ppocr/modeling/heads/rec_att_head.py
ppocr/modeling/heads/rec_att_head.py
+8
-4
No files found.
ppocr/modeling/heads/rec_att_head.py
View file @
a094d277
...
...
@@ -64,8 +64,10 @@ class AttentionHead(nn.Layer):
(
outputs
,
hidden
),
alpha
=
self
.
attention_cell
(
hidden
,
inputs
,
char_onehots
)
probs_step
=
self
.
generator
(
outputs
)
probs
=
paddle
.
unsqueeze
(
probs_step
,
axis
=
1
)
if
probs
is
None
else
paddle
.
concat
(
if
probs
is
None
:
probs
=
paddle
.
unsqueeze
(
probs_step
,
axis
=
1
)
else
:
probs
=
paddle
.
concat
(
[
probs
,
paddle
.
unsqueeze
(
probs_step
,
axis
=
1
)],
axis
=
1
)
next_input
=
probs_step
.
argmax
(
axis
=
1
)
...
...
@@ -152,8 +154,10 @@ class AttentionLSTM(nn.Layer):
char_onehots
)
probs_step
=
self
.
generator
(
hidden
[
0
])
hidden
=
(
hidden
[
1
][
0
],
hidden
[
1
][
1
])
probs
=
paddle
.
unsqueeze
(
probs_step
,
axis
=
1
)
if
probs
is
None
else
paddle
.
concat
(
if
probs
is
None
:
probs
=
paddle
.
unsqueeze
(
probs_step
,
axis
=
1
)
else
:
probs
=
paddle
.
concat
(
[
probs
,
paddle
.
unsqueeze
(
probs_step
,
axis
=
1
)],
axis
=
1
)
...
...
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