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
4cdad758
"...text-generation-inference.git" did not exist on "2788d41a76c193d4de7055dc5ef38a97f25c38b5"
Commit
4cdad758
authored
May 06, 2022
by
andyjpaddle
Browse files
fix sar training on windows
parent
2de63562
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
ppocr/modeling/heads/rec_sar_head.py
ppocr/modeling/heads/rec_sar_head.py
+4
-4
No files found.
ppocr/modeling/heads/rec_sar_head.py
View file @
4cdad758
...
...
@@ -99,8 +99,8 @@ class SAREncoder(nn.Layer):
if
valid_ratios
is
not
None
:
valid_hf
=
[]
T
=
holistic_feat
.
shape
[
1
]
for
i
,
valid_ratio
in
enumerate
(
valid_ratios
):
valid_step
=
min
(
T
,
math
.
ceil
(
T
*
valid_ratio
))
-
1
for
i
in
range
(
len
(
valid_ratios
)
)
:
valid_step
=
min
(
T
,
math
.
ceil
(
T
*
valid_ratio
s
[
i
]
))
-
1
valid_hf
.
append
(
holistic_feat
[
i
,
valid_step
,
:])
valid_hf
=
paddle
.
stack
(
valid_hf
,
axis
=
0
)
else
:
...
...
@@ -252,8 +252,8 @@ class ParallelSARDecoder(BaseDecoder):
if
valid_ratios
is
not
None
:
# cal mask of attention weight
for
i
,
valid_ratio
in
enumerate
(
valid_ratios
):
valid_width
=
min
(
w
,
math
.
ceil
(
w
*
valid_ratio
))
for
i
in
range
(
len
(
valid_ratios
)
)
:
valid_width
=
min
(
w
,
math
.
ceil
(
w
*
valid_ratio
s
[
i
]
))
if
valid_width
<
w
:
attn_weight
[
i
,
:,
:,
valid_width
:,
:]
=
float
(
'-inf'
)
...
...
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