提交 3aae7815 编写于 作者: W wanghaoshuang

Change the dims of empty result to [1, 1]

上级 863cd9c7
......@@ -82,7 +82,7 @@ class CTCAlignOpCUDAKernel : public framework::OpKernel<T> {
output->Resize({static_cast<int64_t>(host_out_lod0.back()), 1});
if (host_out_lod0.back() == 0) {
output->Resize({1});
output->Resize({1, 1});
output->mutable_data<T>(ctx.GetPlace());
math::SetConstant<platform::CUDADeviceContext, T> set_constant;
set_constant(ctx.template device_context<platform::CUDADeviceContext>(),
......
......@@ -71,7 +71,7 @@ class CTCAlignKernel : public framework::OpKernel<T> {
output->Resize({static_cast<int64_t>(output_lod0.back()), 1});
// for empty sequence
if (output_lod0.back() == 0) {
output->Resize({1});
output->Resize({1, 1});
output_data = output->mutable_data<T>(ctx.GetPlace());
output_data[0] = -1;
}
......
......@@ -2526,7 +2526,7 @@ def ctc_greedy_decoder(input, blank, name=None):
Returns:
Variable: CTC greedy decode result. If all the sequences in result were
empty, the result LoDTensor will be [-1] with LoD [[0]] and dims [1].
empty, the result LoDTensor will be [-1] with LoD [[0]] and dims [1, 1].
Examples:
.. code-block:: python
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册