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
902fffcc
Commit
902fffcc
authored
Sep 22, 2021
by
andyjpaddle
Browse files
fix slice in sar head
parent
f4b3d49b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
ppocr/modeling/heads/rec_sar_head.py
ppocr/modeling/heads/rec_sar_head.py
+2
-1
No files found.
ppocr/modeling/heads/rec_sar_head.py
View file @
902fffcc
...
@@ -235,7 +235,8 @@ class ParallelSARDecoder(BaseDecoder):
...
@@ -235,7 +235,8 @@ class ParallelSARDecoder(BaseDecoder):
# cal mask of attention weight
# cal mask of attention weight
for
i
,
valid_ratio
in
enumerate
(
valid_ratios
):
for
i
,
valid_ratio
in
enumerate
(
valid_ratios
):
valid_width
=
min
(
w
,
math
.
ceil
(
w
*
valid_ratio
))
valid_width
=
min
(
w
,
math
.
ceil
(
w
*
valid_ratio
))
attn_weight
[
i
,
:,
:,
valid_width
:,
:]
=
float
(
'-inf'
)
if
valid_width
<
w
:
attn_weight
[
i
,
:,
:,
valid_width
:,
:]
=
float
(
'-inf'
)
attn_weight
=
paddle
.
reshape
(
attn_weight
,
[
bsz
,
T
,
-
1
])
attn_weight
=
paddle
.
reshape
(
attn_weight
,
[
bsz
,
T
,
-
1
])
attn_weight
=
F
.
softmax
(
attn_weight
,
axis
=-
1
)
attn_weight
=
F
.
softmax
(
attn_weight
,
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