Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
82d68281
P
Paddle
项目概览
机器未来
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
82d68281
编写于
12月 05, 2018
作者:
X
Xin Pan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
follow comments
test=develop
上级
41c28d54
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
12 addition
and
8 deletion
+12
-8
paddle/fluid/framework/operator_test.cc
paddle/fluid/framework/operator_test.cc
+8
-7
paddle/fluid/operators/conv_op.cc
paddle/fluid/operators/conv_op.cc
+4
-1
未找到文件。
paddle/fluid/framework/operator_test.cc
浏览文件 @
82d68281
...
...
@@ -97,6 +97,8 @@ TEST(OperatorBase, all) {
namespace
paddle
{
namespace
framework
{
static
int
special_type_value
=
1
;
class
OpKernelTestProtoAndCheckerMaker
:
public
OpProtoAndCheckerMaker
{
public:
void
Make
()
{
...
...
@@ -211,15 +213,12 @@ REGISTER_OP_WITHOUT_GRADIENT(
op_with_kernel
,
paddle
::
framework
::
OpWithKernelTest
,
paddle
::
framework
::
OpKernelTestProtoAndCheckerMaker
);
// REGISTER_OP_CPU_KERNEL(op_with_kernel,
// paddle::framework::CPUKernelTest<float, float>);
REGISTER_OP_KERNEL_WITH_CUSTOM_TYPE
(
op_with_kernel
,
CPU
,
paddle
::
platform
::
CPUPlace
,
DEFAULT_TYPE
,
0
,
REGISTER_OP_CPU_KERNEL
(
op_with_kernel
,
paddle
::
framework
::
CPUKernelTest
<
float
,
float
>
);
REGISTER_OP_KERNEL_WITH_CUSTOM_TYPE
(
op_with_kernel
,
CPU
,
paddle
::
platform
::
CPUPlace
,
SPECIAL
,
1
,
op_with_kernel
,
CPU
,
paddle
::
platform
::
CPUPlace
,
MY_SPECIAL_NAME
,
paddle
::
framework
::
special_type_value
,
paddle
::
framework
::
CPUKernel2Test
<
float
,
float
>
);
// test with single input
...
...
@@ -241,6 +240,7 @@ TEST(OpKernel, all) {
auto
op
=
paddle
::
framework
::
OpRegistry
::
CreateOp
(
op_desc
);
ASSERT_EQ
(
paddle
::
framework
::
cpu_kernel_run_num
,
0
);
op
->
Run
(
scope
,
cpu_place
);
// kerne_sub_type = 0, hence cpu_kernel is called, cpu_kernel2 is not called.
ASSERT_EQ
(
paddle
::
framework
::
cpu_kernel_run_num
,
1
);
ASSERT_EQ
(
paddle
::
framework
::
cpu_kernel2_run_num
,
0
);
...
...
@@ -250,6 +250,7 @@ TEST(OpKernel, all) {
attr
->
set_i
(
1
);
auto
op2
=
paddle
::
framework
::
OpRegistry
::
CreateOp
(
op_desc
);
op2
->
Run
(
scope
,
cpu_place
);
// kerne_sub_type = 1, hence cpu_kernel2 is called, cpu_kernel is not called.
ASSERT_EQ
(
paddle
::
framework
::
cpu_kernel_run_num
,
1
);
ASSERT_EQ
(
paddle
::
framework
::
cpu_kernel2_run_num
,
1
);
}
...
...
paddle/fluid/operators/conv_op.cc
浏览文件 @
82d68281
...
...
@@ -345,6 +345,8 @@ void ConvOpGrad::InferShape(framework::InferShapeContext* ctx) const {
framework
::
OpKernelType
ConvOpGrad
::
GetExpectedKernelType
(
const
framework
::
ExecutionContext
&
ctx
)
const
{
int
customized_type_value
=
framework
::
OpKernelType
::
kDefaultCustomizedTypeValue
;
framework
::
LibraryType
library_
{
framework
::
LibraryType
::
kPlain
};
// TODO(pzelazko-intel): enable MKLDNN layout when it's ready
std
::
string
data_format
=
ctx
.
Attr
<
std
::
string
>
(
"data_format"
);
...
...
@@ -360,12 +362,13 @@ framework::OpKernelType ConvOpGrad::GetExpectedKernelType(
platform
::
CanMKLDNNBeUsed
(
ctx
))
{
library_
=
framework
::
LibraryType
::
kMKLDNN
;
layout_
=
framework
::
DataLayout
::
kMKLDNN
;
customized_type_value
=
kConvMKLDNNFP32
;
}
#endif
return
framework
::
OpKernelType
(
framework
::
ToDataType
(
ctx
.
Input
<
Tensor
>
(
"Input"
)
->
type
()),
ctx
.
GetPlace
(),
layout_
,
library_
);
layout_
,
library_
,
customized_type_value
);
}
}
// namespace operators
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录