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
65d3dfc7
Commit
65d3dfc7
authored
Nov 10, 2020
by
WenmuZhou
Browse files
rnn支持导出
parent
2f9f258f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
ppocr/modeling/necks/rnn.py
ppocr/modeling/necks/rnn.py
+5
-3
No files found.
ppocr/modeling/necks/rnn.py
View file @
65d3dfc7
...
@@ -28,8 +28,9 @@ class Im2Seq(nn.Layer):
...
@@ -28,8 +28,9 @@ class Im2Seq(nn.Layer):
def
forward
(
self
,
x
):
def
forward
(
self
,
x
):
B
,
C
,
H
,
W
=
x
.
shape
B
,
C
,
H
,
W
=
x
.
shape
x
=
x
.
reshape
((
B
,
-
1
,
W
))
assert
H
==
1
x
=
x
.
transpose
((
0
,
2
,
1
))
# (NTC)(batch, width, channels)
x
=
x
.
squeeze
(
axis
=
2
)
x
=
x
.
transpose
([
0
,
2
,
1
])
# (NTC)(batch, width, channels)
return
x
return
x
...
@@ -76,7 +77,8 @@ class SequenceEncoder(nn.Layer):
...
@@ -76,7 +77,8 @@ class SequenceEncoder(nn.Layer):
'fc'
:
EncoderWithFC
,
'fc'
:
EncoderWithFC
,
'rnn'
:
EncoderWithRNN
'rnn'
:
EncoderWithRNN
}
}
assert
encoder_type
in
support_encoder_dict
,
'{} must in {}'
.
format
(
encoder_type
,
support_encoder_dict
.
keys
())
assert
encoder_type
in
support_encoder_dict
,
'{} must in {}'
.
format
(
encoder_type
,
support_encoder_dict
.
keys
())
self
.
encoder
=
support_encoder_dict
[
encoder_type
](
self
.
encoder
=
support_encoder_dict
[
encoder_type
](
self
.
encoder_reshape
.
out_channels
,
hidden_size
)
self
.
encoder_reshape
.
out_channels
,
hidden_size
)
...
...
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