Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
xuning
/
sherpaonnx
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
HieDean
2023-11-17 12:07:47 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
GitHub
2023-11-17 12:07:47 +0800
Commit
1a6a41eb2c6570e67ca7f7f471683bc31698beab
1a6a41eb
1 parent
eeda1e19
Judge before UseCachedDecoderOut (#431)
Co-authored-by: hiedean <hiedean@tju.edu.cn>
显示空白字符变更
内嵌
并排对比
正在显示
1 个修改的文件
包含
17 行增加
和
2 行删除
sherpa-onnx/csrc/online-transducer-greedy-search-decoder.cc
sherpa-onnx/csrc/online-transducer-greedy-search-decoder.cc
查看文件 @
1a6a41e
...
...
@@ -89,9 +89,24 @@ void OnlineTransducerGreedySearchDecoder::Decode(
int32_t
num_frames
=
static_cast
<
int32_t
>
(
encoder_out_shape
[
1
]);
int32_t
vocab_size
=
model_
->
VocabSize
();
Ort
::
Value
decoder_input
=
model_
->
BuildDecoderInput
(
*
result
);
Ort
::
Value
decoder_out
=
model_
->
RunDecoder
(
std
::
move
(
decoder_input
));
Ort
::
Value
decoder_out
{
nullptr
};
bool
is_batch_decoder_out_cached
=
true
;
for
(
const
auto
&
r
:
*
result
)
{
if
(
!
r
.
decoder_out
)
{
is_batch_decoder_out_cached
=
false
;
break
;
}
}
if
(
is_batch_decoder_out_cached
)
{
auto
&
r
=
result
->
front
();
std
::
vector
<
int64_t
>
decoder_out_shape
=
r
.
decoder_out
.
GetTensorTypeAndShapeInfo
().
GetShape
();
decoder_out_shape
[
0
]
=
batch_size
;
decoder_out
=
Ort
::
Value
::
CreateTensor
<
float
>
(
model_
->
Allocator
(),
decoder_out_shape
.
data
(),
decoder_out_shape
.
size
());
UseCachedDecoderOut
(
*
result
,
&
decoder_out
);
}
else
{
Ort
::
Value
decoder_input
=
model_
->
BuildDecoderInput
(
*
result
);
decoder_out
=
model_
->
RunDecoder
(
std
::
move
(
decoder_input
));
}
for
(
int32_t
t
=
0
;
t
!=
num_frames
;
++
t
)
{
Ort
::
Value
cur_encoder_out
=
...
...
请
注册
或
登录
后发表评论