Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
9ba3f429
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看板
未验证
提交
9ba3f429
编写于
2月 14, 2022
作者:
T
TTerror
提交者:
GitHub
2月 14, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update xpu test build script and fix get_test_cover_info, *test=kunlun (#39235)
上级
1b9e6790
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
60 addition
and
16 deletion
+60
-16
paddle/scripts/paddle_build.sh
paddle/scripts/paddle_build.sh
+2
-2
python/paddle/fluid/tests/unittests/xpu/get_test_cover_info.py
...n/paddle/fluid/tests/unittests/xpu/get_test_cover_info.py
+56
-12
python/paddle/fluid/tests/unittests/xpu/test_refactor_op_xpu.py
.../paddle/fluid/tests/unittests/xpu/test_refactor_op_xpu.py
+2
-2
未找到文件。
paddle/scripts/paddle_build.sh
浏览文件 @
9ba3f429
...
...
@@ -1759,11 +1759,11 @@ set +x
set
-x
ut_endTime_s
=
`
date
+%s
`
echo
"XPU testCase Time:
$[
$ut_endTime_s
-
$ut_startTime_s
]s"
python
${
PADDLE_ROOT
}
/build/python/paddle/fluid/tests/unittests/xpu/get_test_cover_info.py
unset
XPU_OP_LIST_DIR
if
[[
"
$EXIT_CODE
"
!=
"0"
]]
;
then
exit
8
;
fi
python
${
PADDLE_ROOT
}
/build/python/paddle/fluid/tests/unittests/xpu/get_test_cover_info.py
unset
XPU_OP_LIST_DIR
fi
}
...
...
python/paddle/fluid/tests/unittests/xpu/get_test_cover_info.py
浏览文件 @
9ba3f429
...
...
@@ -17,6 +17,7 @@ from __future__ import print_function
import
inspect
import
os
import
fcntl
import
numpy
as
np
import
paddle
import
paddle.fluid.core
as
core
...
...
@@ -29,28 +30,61 @@ type_dict_paddle_to_str = {
paddle
.
int32
:
'int32'
,
paddle
.
int64
:
'int64'
,
paddle
.
float16
:
'float16'
,
paddle
.
bfloat16
:
'bfloat16'
,
paddle
.
float32
:
'float32'
,
paddle
.
float64
:
'float64'
,
paddle
.
complex128
:
'complex128'
,
paddle
.
complex64
:
'complex64'
,
}
type_dict_paddle_to_numpy
=
{
paddle
.
bool
:
np
.
bool_
,
paddle
.
uint8
:
np
.
uint8
,
paddle
.
int8
:
np
.
int8
,
paddle
.
int16
:
np
.
int16
,
paddle
.
int32
:
np
.
int32
,
paddle
.
int64
:
np
.
int64
,
paddle
.
bfloat16
:
np
.
uint16
,
paddle
.
float16
:
np
.
float16
,
paddle
.
float32
:
np
.
float32
,
paddle
.
float64
:
np
.
float64
,
paddle
.
complex128
:
np
.
complex128
,
paddle
.
complex64
:
np
.
complex64
,
}
type_dict_str_to_paddle
=
{
'uint8'
:
paddle
.
uint8
,
'int8'
:
paddle
.
int8
,
'int16'
:
paddle
.
int16
,
'int32'
:
paddle
.
int32
,
'int64'
:
paddle
.
int64
,
'
float32'
:
paddle
.
float32
,
'
bfloat16'
:
paddle
.
bfloat16
,
'float16'
:
paddle
.
float16
,
'float32'
:
paddle
.
float32
,
'float64'
:
paddle
.
float64
,
'bool'
:
paddle
.
bool
,
'uint8'
:
paddle
.
uint8
,
'int8'
:
paddle
.
int8
,
'complex128'
:
paddle
.
complex128
,
'complex64'
:
paddle
.
complex64
,
'int16'
:
paddle
.
int16
,
'complex128'
:
paddle
.
complex128
,
}
type_dict_str_to_numpy
=
{
'uint8'
:
np
.
uint8
,
'int8'
:
np
.
int8
,
'int16'
:
np
.
int16
,
'int32'
:
np
.
int32
,
'int64'
:
np
.
int64
,
'bfloat16'
:
np
.
uint16
,
'float16'
:
np
.
float16
,
'float32'
:
np
.
float32
,
'float64'
:
np
.
float64
,
'bool'
:
np
.
bool_
,
'complex64'
:
np
.
complex64
,
'complex128'
:
np
.
complex128
,
}
xpu_test_op_white_list
=
[]
xpu_test_type_white_list
=
[]
xpu_test_op_type_white_list
=
[]
xpu_test_op_type_white_list
=
[
'float64'
]
xpu_test_device_op_white_list
=
[]
xpu_test_device_op_type_white_list
=
[]
...
...
@@ -122,6 +156,8 @@ def make_xpu_op_list(xpu_version):
if
op_name
in
op_white_list
or
device_op_name
in
device_op_white_list
:
continue
for
op_type
in
type_list
:
if
op_type
==
paddle
.
bfloat16
:
op_type
=
paddle
.
bfloat16
if
op_type
in
type_white_list
or
op_type
not
in
type_dict_paddle_to_str
.
keys
(
):
continue
...
...
@@ -143,10 +179,17 @@ def get_xpu_op_support_types(op_name, dev_id=0):
xpu_version
=
core
.
get_xpu_device_version
(
dev_id
)
support_type_list
=
core
.
get_xpu_device_op_support_types
(
op_name
,
xpu_version
)
support_type_str_list
=
[
type_dict_paddle_to_str
[
x
]
for
x
in
support_type_list
support_type_str_list
=
[]
for
stype
in
support_type_list
:
if
stype
==
paddle
.
bfloat16
:
support_type_str_list
.
append
(
type_dict_paddle_to_str
[
paddle
.
bfloat16
])
else
:
support_type_str_list
.
append
(
type_dict_paddle_to_str
[
stype
])
type_white_list
=
get_op_type_white_list
()
return
[
stype
for
stype
in
support_type_str_list
if
stype
not
in
type_white_list
]
return
support_type_str_list
def
record_op_test
(
op_name
,
test_type
):
...
...
@@ -196,8 +239,9 @@ def create_test_class(func_globals,
continue
class_obj
=
test_class
[
1
]
cls_name
=
"{0}_{1}"
.
format
(
test_class
[
0
],
str
(
test_type
))
func_globals
[
cls_name
]
=
type
(
cls_name
,
(
class_obj
,
),
{
'in_type'
:
test_type
})
func_globals
[
cls_name
]
=
type
(
cls_name
,
(
class_obj
,
),
{
'in_type'
:
type_dict_str_to_numpy
[
test_type
]})
if
hasattr
(
test_class_obj
,
'use_dynamic_create_class'
)
and
test_class_obj
.
use_dynamic_create_class
:
...
...
@@ -205,7 +249,7 @@ def create_test_class(func_globals,
for
dy_class
in
dynamic_classes
:
cls_name
=
"{0}_{1}"
.
format
(
dy_class
[
0
],
str
(
test_type
))
attr_dict
=
dy_class
[
1
]
attr_dict
[
'in_type'
]
=
t
est_type
attr_dict
[
'in_type'
]
=
t
ype_dict_str_to_numpy
[
test_type
]
func_globals
[
cls_name
]
=
type
(
cls_name
,
(
base_class
,
),
attr_dict
)
record_op_test
(
op_name
,
test_type
)
...
...
python/paddle/fluid/tests/unittests/xpu/test_refactor_op_xpu.py
浏览文件 @
9ba3f429
...
...
@@ -69,7 +69,7 @@ class XPUTestArgsortOp1(XPUOpTestWrapper):
self
.
descending
=
False
if
not
hasattr
(
self
,
'init_descending'
)
else
self
.
init_descending
if
self
.
in_type
==
'float32'
:
if
self
.
in_type
==
np
.
float32
:
self
.
x
=
np
.
random
.
random
(
self
.
input_shape
).
astype
(
self
.
dtype
)
else
:
self
.
x
=
np
.
random
.
randint
(
...
...
@@ -118,7 +118,7 @@ class XPUTestArgsortOp2(XPUOpTestWrapper):
self
.
init_axis
()
self
.
init_direction
()
if
self
.
in_type
==
'float32'
:
if
self
.
in_type
==
np
.
float32
:
self
.
x
=
np
.
random
.
random
(
self
.
input_shape
).
astype
(
self
.
dtype
)
else
:
self
.
x
=
np
.
random
.
randint
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录