Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
251c2fd5
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
251c2fd5
编写于
2月 02, 2018
作者:
G
gaoyuan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update according to the code review
上级
e14272bb
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
12 addition
and
9 deletion
+12
-9
paddle/operators/box_coder_op.cc
paddle/operators/box_coder_op.cc
+2
-0
paddle/operators/box_coder_op.cu
paddle/operators/box_coder_op.cu
+1
-1
paddle/operators/box_coder_op.h
paddle/operators/box_coder_op.h
+9
-8
未找到文件。
paddle/operators/box_coder_op.cc
浏览文件 @
251c2fd5
...
@@ -26,6 +26,8 @@ class BoxCoderOp : public framework::OperatorWithKernel {
...
@@ -26,6 +26,8 @@ class BoxCoderOp : public framework::OperatorWithKernel {
"Input(PriorBoxVar) of BoxCoderOp should not be null."
);
"Input(PriorBoxVar) of BoxCoderOp should not be null."
);
PADDLE_ENFORCE
(
ctx
->
HasInput
(
"PriorBox"
),
PADDLE_ENFORCE
(
ctx
->
HasInput
(
"PriorBox"
),
"Input(TargetBox) of BoxCoderOp should not be null."
);
"Input(TargetBox) of BoxCoderOp should not be null."
);
PADDLE_ENFORCE
(
ctx
->
HasOutput
(
"OutputBox"
),
"Output(OutputBox) of BoxCoderOp should not be null."
);
auto
prior_box_dims
=
ctx
->
GetInputDim
(
"PriorBox"
);
auto
prior_box_dims
=
ctx
->
GetInputDim
(
"PriorBox"
);
auto
prior_box_var_dims
=
ctx
->
GetInputDim
(
"PriorBoxVar"
);
auto
prior_box_var_dims
=
ctx
->
GetInputDim
(
"PriorBoxVar"
);
...
...
paddle/operators/box_coder_op.cu
浏览文件 @
251c2fd5
...
@@ -109,7 +109,7 @@ class BoxCoderCUDAKernel : public framework::OpKernel<T> {
...
@@ -109,7 +109,7 @@ class BoxCoderCUDAKernel : public framework::OpKernel<T> {
auto
*
prior_box
=
context
.
Input
<
framework
::
Tensor
>
(
"PriorBox"
);
auto
*
prior_box
=
context
.
Input
<
framework
::
Tensor
>
(
"PriorBox"
);
auto
*
prior_box_var
=
context
.
Input
<
framework
::
Tensor
>
(
"PriorBoxVar"
);
auto
*
prior_box_var
=
context
.
Input
<
framework
::
Tensor
>
(
"PriorBoxVar"
);
auto
*
target_box
=
context
.
Input
<
framework
::
LoDTensor
>
(
"TargetBox"
);
auto
*
target_box
=
context
.
Input
<
framework
::
LoDTensor
>
(
"TargetBox"
);
auto
*
output_box
=
context
.
Output
<
Tensor
>
(
"OutputBox"
);
auto
*
output_box
=
context
.
Output
<
framework
::
Tensor
>
(
"OutputBox"
);
if
(
target_box
->
lod
().
size
())
{
if
(
target_box
->
lod
().
size
())
{
PADDLE_ENFORCE_EQ
(
target_box
->
lod
().
size
(),
1
,
PADDLE_ENFORCE_EQ
(
target_box
->
lod
().
size
(),
1
,
...
...
paddle/operators/box_coder_op.h
浏览文件 @
251c2fd5
...
@@ -16,9 +16,6 @@ limitations under the License. */
...
@@ -16,9 +16,6 @@ limitations under the License. */
namespace
paddle
{
namespace
paddle
{
namespace
operators
{
namespace
operators
{
using
Tensor
=
framework
::
Tensor
;
using
LoDTensor
=
framework
::
LoDTensor
;
enum
class
BoxCodeType
{
kEncodeCenterSize
=
0
,
kDecodeCenterSize
=
1
};
enum
class
BoxCodeType
{
kEncodeCenterSize
=
0
,
kDecodeCenterSize
=
1
};
inline
BoxCodeType
GetBoxCodeType
(
const
std
::
string
&
type
)
{
inline
BoxCodeType
GetBoxCodeType
(
const
std
::
string
&
type
)
{
...
@@ -33,8 +30,10 @@ inline BoxCodeType GetBoxCodeType(const std::string& type) {
...
@@ -33,8 +30,10 @@ inline BoxCodeType GetBoxCodeType(const std::string& type) {
template
<
typename
T
>
template
<
typename
T
>
class
BoxCoderKernel
:
public
framework
::
OpKernel
<
T
>
{
class
BoxCoderKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
public:
void
EncodeCenterSize
(
const
Tensor
&
target_box
,
const
Tensor
&
prior_box
,
void
EncodeCenterSize
(
const
framework
::
Tensor
&
target_box
,
const
Tensor
&
prior_box_var
,
T
*
output
)
const
{
const
framework
::
Tensor
&
prior_box
,
const
framework
::
Tensor
&
prior_box_var
,
T
*
output
)
const
{
int64_t
row
=
target_box
.
dims
()[
0
];
int64_t
row
=
target_box
.
dims
()[
0
];
int64_t
col
=
prior_box
.
dims
()[
0
];
int64_t
col
=
prior_box
.
dims
()[
0
];
int64_t
len
=
prior_box
.
dims
()[
1
];
int64_t
len
=
prior_box
.
dims
()[
1
];
...
@@ -76,8 +75,10 @@ class BoxCoderKernel : public framework::OpKernel<T> {
...
@@ -76,8 +75,10 @@ class BoxCoderKernel : public framework::OpKernel<T> {
}
}
}
}
}
}
void
DecodeCenterSize
(
const
Tensor
&
target_box
,
const
Tensor
&
prior_box
,
void
DecodeCenterSize
(
const
framework
::
Tensor
&
target_box
,
const
Tensor
&
prior_box_var
,
T
*
output
)
const
{
const
framework
::
Tensor
&
prior_box
,
const
framework
::
Tensor
&
prior_box_var
,
T
*
output
)
const
{
int64_t
row
=
target_box
.
dims
()[
0
];
int64_t
row
=
target_box
.
dims
()[
0
];
int64_t
col
=
prior_box
.
dims
()[
0
];
int64_t
col
=
prior_box
.
dims
()[
0
];
int64_t
len
=
prior_box
.
dims
()[
1
];
int64_t
len
=
prior_box
.
dims
()[
1
];
...
@@ -124,7 +125,7 @@ class BoxCoderKernel : public framework::OpKernel<T> {
...
@@ -124,7 +125,7 @@ class BoxCoderKernel : public framework::OpKernel<T> {
auto
*
prior_box
=
context
.
Input
<
framework
::
Tensor
>
(
"PriorBox"
);
auto
*
prior_box
=
context
.
Input
<
framework
::
Tensor
>
(
"PriorBox"
);
auto
*
prior_box_var
=
context
.
Input
<
framework
::
Tensor
>
(
"PriorBoxVar"
);
auto
*
prior_box_var
=
context
.
Input
<
framework
::
Tensor
>
(
"PriorBoxVar"
);
auto
*
target_box
=
context
.
Input
<
framework
::
LoDTensor
>
(
"TargetBox"
);
auto
*
target_box
=
context
.
Input
<
framework
::
LoDTensor
>
(
"TargetBox"
);
auto
*
output_box
=
context
.
Output
<
Tensor
>
(
"OutputBox"
);
auto
*
output_box
=
context
.
Output
<
framework
::
Tensor
>
(
"OutputBox"
);
if
(
target_box
->
lod
().
size
())
{
if
(
target_box
->
lod
().
size
())
{
PADDLE_ENFORCE_EQ
(
target_box
->
lod
().
size
(),
1UL
,
PADDLE_ENFORCE_EQ
(
target_box
->
lod
().
size
(),
1UL
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录