Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
a3703888
P
PaddleDetection
项目概览
s920243400
/
PaddleDetection
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleDetection
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
a3703888
编写于
12月 12, 2018
作者:
T
tensor-tang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix unit test with double type
上级
417d031f
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
33 addition
and
24 deletion
+33
-24
paddle/fluid/operators/jit/helper.h
paddle/fluid/operators/jit/helper.h
+27
-17
paddle/fluid/operators/jit/test.cc
paddle/fluid/operators/jit/test.cc
+6
-7
未找到文件。
paddle/fluid/operators/jit/helper.h
浏览文件 @
a3703888
...
@@ -33,8 +33,11 @@ namespace jit {
...
@@ -33,8 +33,11 @@ namespace jit {
#define EXP_MAX_INPUT 40.0
#define EXP_MAX_INPUT 40.0
template
<
KernelType
KT
,
typename
KernelTuples
,
typename
PlaceType
>
template
<
KernelType
KT
,
typename
KernelTuples
,
typename
PlaceType
>
inline
typename
KernelTuples
::
func_type
GetJitCode
(
inline
typename
std
::
enable_if
<
typename
KernelTuples
::
attr_type
attr
)
{
std
::
is_same
<
typename
KernelTuples
::
data_type
,
float
>::
value
&&
std
::
is_same
<
PlaceType
,
platform
::
CPUPlace
>::
value
,
typename
KernelTuples
::
func_type
>::
type
GetJitCode
(
typename
KernelTuples
::
attr_type
attr
)
{
using
Func
=
typename
KernelTuples
::
func_type
;
using
Func
=
typename
KernelTuples
::
func_type
;
using
Attr
=
typename
KernelTuples
::
attr_type
;
using
Attr
=
typename
KernelTuples
::
attr_type
;
size_t
key
=
JitCodeKey
<
Attr
>
(
attr
);
size_t
key
=
JitCodeKey
<
Attr
>
(
attr
);
...
@@ -45,7 +48,6 @@ inline typename KernelTuples::func_type GetJitCode(
...
@@ -45,7 +48,6 @@ inline typename KernelTuples::func_type GetJitCode(
// creator is not related with attr, so can use KernelKey as key
// creator is not related with attr, so can use KernelKey as key
KernelKey
kkey
(
KT
,
PlaceType
());
KernelKey
kkey
(
KT
,
PlaceType
());
if
(
std
::
is_same
<
PlaceType
,
platform
::
CPUPlace
>::
value
)
{
// pool: (KernelKey(type, place), vector<GenCreatorPtr>)
// pool: (KernelKey(type, place), vector<GenCreatorPtr>)
auto
&
creator_map
=
JitCodeCreatorPool
().
Instance
().
AllCreators
();
auto
&
creator_map
=
JitCodeCreatorPool
().
Instance
().
AllCreators
();
auto
iter
=
creator_map
.
find
(
kkey
);
auto
iter
=
creator_map
.
find
(
kkey
);
...
@@ -63,7 +65,15 @@ inline typename KernelTuples::func_type GetJitCode(
...
@@ -63,7 +65,15 @@ inline typename KernelTuples::func_type GetJitCode(
}
}
}
}
}
}
}
return
nullptr
;
}
template
<
KernelType
KT
,
typename
KernelTuples
,
typename
PlaceType
>
inline
typename
std
::
enable_if
<
!
std
::
is_same
<
typename
KernelTuples
::
data_type
,
float
>::
value
||
!
std
::
is_same
<
PlaceType
,
platform
::
CPUPlace
>::
value
,
typename
KernelTuples
::
func_type
>::
type
GetJitCode
(
typename
KernelTuples
::
attr_type
attr
)
{
return
nullptr
;
return
nullptr
;
}
}
...
...
paddle/fluid/operators/jit/test.cc
浏览文件 @
a3703888
...
@@ -48,13 +48,13 @@ void ExpectEQ(const T* target, const T* refer, int n) {
...
@@ -48,13 +48,13 @@ void ExpectEQ(const T* target, const T* refer, int n) {
std
::
vector
<
int
>
TestSizes
()
{
std
::
vector
<
int
>
TestSizes
()
{
std
::
vector
<
int
>
s
;
std
::
vector
<
int
>
s
;
for
(
int
i
=
1
;
i
<
10
;
++
i
)
{
for
(
int
i
=
1
;
i
<
32
;
++
i
)
{
s
.
push_back
(
i
);
s
.
push_back
(
i
);
}
}
//
//
test some large size
// test some large size
//
s.push_back(100);
s
.
push_back
(
100
);
//
s.push_back(1000);
s
.
push_back
(
1000
);
//
s.push_back(2000);
s
.
push_back
(
2000
);
return
s
;
return
s
;
}
}
...
@@ -148,8 +148,7 @@ void TestXYZNKernel() {
...
@@ -148,8 +148,7 @@ void TestXYZNKernel() {
TEST
(
JITKernel
,
vmul
)
{
TEST
(
JITKernel
,
vmul
)
{
namespace
jit
=
paddle
::
operators
::
jit
;
namespace
jit
=
paddle
::
operators
::
jit
;
TestXYZNKernel
<
jit
::
vmul
,
float
,
paddle
::
platform
::
CPUPlace
>
();
TestXYZNKernel
<
jit
::
vmul
,
float
,
paddle
::
platform
::
CPUPlace
>
();
// TODO(TJ): fix double issue
TestXYZNKernel
<
jit
::
vmul
,
double
,
paddle
::
platform
::
CPUPlace
>
();
// TestXYZNKernel<jit::vmul, double, paddle::platform::CPUPlace>();
}
}
TEST
(
JITKernel
,
vadd
)
{
TEST
(
JITKernel
,
vadd
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录