Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
10dd6326
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
10dd6326
编写于
1月 16, 2018
作者:
W
wanghaoshuang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename 'ctc_greedy_decode' to 'ctc_decode'
上级
281e93bc
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
15 addition
and
17 deletion
+15
-17
paddle/operators/ctc_decode_op.cc
paddle/operators/ctc_decode_op.cc
+8
-10
paddle/operators/ctc_decode_op.cu
paddle/operators/ctc_decode_op.cu
+4
-4
paddle/operators/ctc_decode_op.h
paddle/operators/ctc_decode_op.h
+1
-1
python/paddle/v2/fluid/tests/test_ctc_decode.py
python/paddle/v2/fluid/tests/test_ctc_decode.py
+2
-2
未找到文件。
paddle/operators/ctc_decode_op.cc
浏览文件 @
10dd6326
...
@@ -12,20 +12,20 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
...
@@ -12,20 +12,20 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
See the License for the specific language governing permissions and
limitations under the License. */
limitations under the License. */
#include "paddle/operators/ctc_
greedy_
decode_op.h"
#include "paddle/operators/ctc_decode_op.h"
namespace
paddle
{
namespace
paddle
{
namespace
operators
{
namespace
operators
{
class
CTC
Greedy
DecodeOp
:
public
framework
::
OperatorWithKernel
{
class
CTCDecodeOp
:
public
framework
::
OperatorWithKernel
{
public:
public:
using
framework
::
OperatorWithKernel
::
OperatorWithKernel
;
using
framework
::
OperatorWithKernel
::
OperatorWithKernel
;
void
InferShape
(
framework
::
InferShapeContext
*
ctx
)
const
override
{
void
InferShape
(
framework
::
InferShapeContext
*
ctx
)
const
override
{
PADDLE_ENFORCE
(
ctx
->
HasInput
(
"Input"
),
PADDLE_ENFORCE
(
ctx
->
HasInput
(
"Input"
),
"Input of CTC
Greedy
DecodeOp should not be null."
);
"Input of CTCDecodeOp should not be null."
);
PADDLE_ENFORCE
(
ctx
->
HasOutput
(
"Output"
),
PADDLE_ENFORCE
(
ctx
->
HasOutput
(
"Output"
),
"Output of CTC
Greedy
DecodeOp should not be null."
);
"Output of CTCDecodeOp should not be null."
);
auto
input_dims
=
ctx
->
GetInputDim
(
"Input"
);
auto
input_dims
=
ctx
->
GetInputDim
(
"Input"
);
...
@@ -42,9 +42,9 @@ class CTCGreedyDecodeOp : public framework::OperatorWithKernel {
...
@@ -42,9 +42,9 @@ class CTCGreedyDecodeOp : public framework::OperatorWithKernel {
}
}
};
};
class
CTC
Greedy
DecodeOpMaker
:
public
framework
::
OpProtoAndCheckerMaker
{
class
CTCDecodeOpMaker
:
public
framework
::
OpProtoAndCheckerMaker
{
public:
public:
CTC
Greedy
DecodeOpMaker
(
OpProto
*
proto
,
OpAttrChecker
*
op_checker
)
CTCDecodeOpMaker
(
OpProto
*
proto
,
OpAttrChecker
*
op_checker
)
:
OpProtoAndCheckerMaker
(
proto
,
op_checker
)
{
:
OpProtoAndCheckerMaker
(
proto
,
op_checker
)
{
AddInput
(
"Input"
,
AddInput
(
"Input"
,
"(LodTensor, default: LoDTensor<int>), Its shape is "
"(LodTensor, default: LoDTensor<int>), Its shape is "
...
@@ -86,9 +86,7 @@ Then:
...
@@ -86,9 +86,7 @@ Then:
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OPERATOR
(
ctc_greedy_decode
,
ops
::
CTCGreedyDecodeOp
,
REGISTER_OPERATOR
(
ctc_decode
,
ops
::
CTCDecodeOp
,
ops
::
CTCDecodeOpMaker
,
ops
::
CTCGreedyDecodeOpMaker
,
paddle
::
framework
::
EmptyGradOpMaker
);
paddle
::
framework
::
EmptyGradOpMaker
);
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
ctc_greedy_decode
,
ctc_decode
,
ops
::
CTCDecodeKernel
<
paddle
::
platform
::
CPUDeviceContext
,
int
>
);
ops
::
CTCGreedyDecodeKernel
<
paddle
::
platform
::
CPUDeviceContext
,
int
>
);
paddle/operators/ctc_decode_op.cu
浏览文件 @
10dd6326
...
@@ -15,7 +15,7 @@ limitations under the License. */
...
@@ -15,7 +15,7 @@ limitations under the License. */
#include <stdio.h>
#include <stdio.h>
#include <thrust/device_vector.h>
#include <thrust/device_vector.h>
#include <thrust/host_vector.h>
#include <thrust/host_vector.h>
#include "paddle/operators/ctc_
greedy_
decode_op.h"
#include "paddle/operators/ctc_decode_op.h"
namespace
paddle
{
namespace
paddle
{
namespace
operators
{
namespace
operators
{
...
@@ -42,7 +42,7 @@ __global__ void MergeAndDelCudaKernel(const int64_t num_token, const T* tokens,
...
@@ -42,7 +42,7 @@ __global__ void MergeAndDelCudaKernel(const int64_t num_token, const T* tokens,
}
}
template
<
typename
T
>
template
<
typename
T
>
class
CTC
Greedy
DecodeOpCUDAKernel
:
public
framework
::
OpKernel
<
T
>
{
class
CTCDecodeOpCUDAKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
public:
void
Compute
(
const
framework
::
ExecutionContext
&
ctx
)
const
override
{
void
Compute
(
const
framework
::
ExecutionContext
&
ctx
)
const
override
{
PADDLE_ENFORCE
(
platform
::
is_gpu_place
(
ctx
.
GetPlace
()),
PADDLE_ENFORCE
(
platform
::
is_gpu_place
(
ctx
.
GetPlace
()),
...
@@ -87,5 +87,5 @@ class CTCGreedyDecodeOpCUDAKernel : public framework::OpKernel<T> {
...
@@ -87,5 +87,5 @@ class CTCGreedyDecodeOpCUDAKernel : public framework::OpKernel<T> {
}
// namespace operators
}
// namespace operators
}
// namespace paddle
}
// namespace paddle
REGISTER_OP_CUDA_KERNEL
(
ctc_
greedy_
decode
,
REGISTER_OP_CUDA_KERNEL
(
ctc_decode
,
paddle
::
operators
::
CTC
Greedy
DecodeOpCUDAKernel
<
int
>
);
paddle
::
operators
::
CTCDecodeOpCUDAKernel
<
int
>
);
paddle/operators/ctc_decode_op.h
浏览文件 @
10dd6326
...
@@ -23,7 +23,7 @@ using Tensor = framework::Tensor;
...
@@ -23,7 +23,7 @@ using Tensor = framework::Tensor;
using
LoDTensor
=
framework
::
LoDTensor
;
using
LoDTensor
=
framework
::
LoDTensor
;
template
<
typename
DeviceContext
,
typename
T
>
template
<
typename
DeviceContext
,
typename
T
>
class
CTC
Greedy
DecodeKernel
:
public
framework
::
OpKernel
<
T
>
{
class
CTCDecodeKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
public:
void
Compute
(
const
framework
::
ExecutionContext
&
ctx
)
const
override
{
void
Compute
(
const
framework
::
ExecutionContext
&
ctx
)
const
override
{
auto
*
input
=
ctx
.
Input
<
LoDTensor
>
(
"Input"
);
auto
*
input
=
ctx
.
Input
<
LoDTensor
>
(
"Input"
);
...
...
python/paddle/v2/fluid/tests/test_ctc_decode.py
浏览文件 @
10dd6326
...
@@ -22,7 +22,7 @@ def CTCDecode(input, lod, blank, merge_repeated):
...
@@ -22,7 +22,7 @@ def CTCDecode(input, lod, blank, merge_repeated):
class
TestCTCDecodeOp
(
OpTest
):
class
TestCTCDecodeOp
(
OpTest
):
def
config
(
self
):
def
config
(
self
):
self
.
op_type
=
"ctc_
greedy_
decode"
self
.
op_type
=
"ctc_decode"
self
.
input_lod
=
[[
0
,
11
,
18
]]
self
.
input_lod
=
[[
0
,
11
,
18
]]
self
.
blank
=
0
self
.
blank
=
0
self
.
merge_repeated
=
False
self
.
merge_repeated
=
False
...
@@ -49,7 +49,7 @@ class TestCTCDecodeOp(OpTest):
...
@@ -49,7 +49,7 @@ class TestCTCDecodeOp(OpTest):
class
TestCTCDecodeOpCase1
(
TestCTCDecodeOp
):
class
TestCTCDecodeOpCase1
(
TestCTCDecodeOp
):
def
config
(
self
):
def
config
(
self
):
self
.
op_type
=
"ctc_
greedy_
decode"
self
.
op_type
=
"ctc_decode"
self
.
input_lod
=
[[
0
,
11
,
18
]]
self
.
input_lod
=
[[
0
,
11
,
18
]]
self
.
blank
=
0
self
.
blank
=
0
self
.
merge_repeated
=
True
self
.
merge_repeated
=
True
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录