Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
9181a99b
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看板
未验证
提交
9181a99b
编写于
7月 15, 2022
作者:
T
taixiurong
提交者:
GitHub
7月 15, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
xpu-paddlepaddle-33 [任务] matmul单测 timeout (#44333)
test=kunlun
上级
676d0b42
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
28 addition
and
2 deletion
+28
-2
python/paddle/fluid/tests/unittests/xpu/CMakeLists.txt
python/paddle/fluid/tests/unittests/xpu/CMakeLists.txt
+3
-1
python/paddle/fluid/tests/unittests/xpu/get_test_cover_info.py
...n/paddle/fluid/tests/unittests/xpu/get_test_cover_info.py
+0
-1
python/paddle/fluid/tests/unittests/xpu/test_matmul_op_xpu.py
...on/paddle/fluid/tests/unittests/xpu/test_matmul_op_xpu.py
+20
-0
python/paddle/fluid/tests/unittests/xpu/test_matmul_v2_op_xpu.py
...paddle/fluid/tests/unittests/xpu/test_matmul_v2_op_xpu.py
+5
-0
未找到文件。
python/paddle/fluid/tests/unittests/xpu/CMakeLists.txt
浏览文件 @
9181a99b
...
...
@@ -24,5 +24,7 @@ foreach(TEST_OP ${DIST_TEST_OPS})
py_test_modules
(
${
TEST_OP
}
MODULES
${
TEST_OP
}
)
endforeach
()
set_tests_properties
(
test_mul_op_xpu PROPERTIES TIMEOUT 120
)
set_tests_properties
(
test_conv2d_op_xpu PROPERTIES TIMEOUT 120
)
set_tests_properties
(
test_mul_op_xpu PROPERTIES TIMEOUT 120
)
set_tests_properties
(
test_matmul_v2_op_xpu PROPERTIES TIMEOUT 900
)
set_tests_properties
(
test_matmul_op_xpu PROPERTIES TIMEOUT 300
)
python/paddle/fluid/tests/unittests/xpu/get_test_cover_info.py
浏览文件 @
9181a99b
...
...
@@ -87,7 +87,6 @@ xpu_test_device_type_white_list = ['xpu1_float64']
xpu_test_op_type_white_list
=
[
'dropout_float16'
,
'dropout_grad_float16'
,
'matmul_v2_float16'
,
"grad_add_float32"
# no api for grad_add, skip
]
xpu_test_device_op_white_list
=
[]
...
...
python/paddle/fluid/tests/unittests/xpu/test_matmul_op_xpu.py
浏览文件 @
9181a99b
...
...
@@ -294,6 +294,10 @@ class TestMatmulBaseGenerator(XPUOpTest):
self
.
op_type
=
"matmul"
self
.
dtype
=
np
.
float32
if
not
hasattr
(
self
,
'in_type'
)
else
self
.
in_type
self
.
__class__
.
no_need_check_grad
=
False
if
not
hasattr
(
self
,
'no_need_check_grad'
)
else
self
.
no_need_check_grad
shape_X
=
[
4
,
5
]
if
not
hasattr
(
self
,
'shape_X'
)
else
self
.
shape_X
shape_Y
=
[
5
,
6
]
if
not
hasattr
(
self
,
'shape_Y'
)
else
self
.
shape_Y
transpose_X
=
False
if
not
hasattr
(
self
,
...
...
@@ -314,12 +318,20 @@ class TestMatmulBaseGenerator(XPUOpTest):
self
.
check_output_with_place
(
place
,
atol
=
1e-3
)
def
test_check_grad_normal
(
self
):
if
hasattr
(
self
.
__class__
,
"no_need_check_grad"
)
and
self
.
__class__
.
no_need_check_grad
==
True
:
return
place
=
paddle
.
XPUPlace
(
0
)
self
.
check_grad_with_place
(
place
,
[
'X'
,
'Y'
],
'Out'
,
max_relative_error
=
5e-2
)
def
test_check_grad_ignore_x
(
self
):
if
hasattr
(
self
.
__class__
,
"no_need_check_grad"
)
and
self
.
__class__
.
no_need_check_grad
==
True
:
return
place
=
paddle
.
XPUPlace
(
0
)
self
.
check_grad_with_place
(
place
,
[
'Y'
],
'Out'
,
...
...
@@ -327,6 +339,10 @@ class TestMatmulBaseGenerator(XPUOpTest):
no_grad_set
=
set
(
"X"
))
def
test_check_grad_ignore_y
(
self
):
if
hasattr
(
self
.
__class__
,
"no_need_check_grad"
)
and
self
.
__class__
.
no_need_check_grad
==
True
:
return
place
=
paddle
.
XPUPlace
(
0
)
self
.
check_grad_with_place
(
place
,
[
'X'
],
'Out'
,
...
...
@@ -351,6 +367,9 @@ class XPUTestMatmulOp1(XPUOpTestWrapper):
for
transose_x
in
[
True
,
False
]:
for
transose_y
in
[
True
,
False
]:
for
batch
in
batch_size
:
no_need_check_grad
=
False
if
batch
>=
5
:
no_need_check_grad
=
True
class_name
=
(
'TestMatMulOp_dimX_{}_dim_Y_{}_transX_{}_transY_{}_batch_{}'
.
format
(
dim_X
,
dim_Y
,
transose_x
,
transose_y
,
...
...
@@ -362,6 +381,7 @@ class XPUTestMatmulOp1(XPUOpTestWrapper):
'shape_Y'
:
shape_y
,
'transpose_X'
:
transose_x
,
'transpose_Y'
:
transose_y
,
'no_need_check_grad'
:
no_need_check_grad
,
'op_type'
:
"matmul"
}
classes
.
append
([
class_name
,
attr_dict
])
...
...
python/paddle/fluid/tests/unittests/xpu/test_matmul_v2_op_xpu.py
浏览文件 @
9181a99b
...
...
@@ -80,6 +80,8 @@ class XPUTestMatmulV2Op(XPUOpTestWrapper):
self
.
dtype
=
self
.
in_type
self
.
config
()
self
.
op_type
=
"matmul_v2"
if
self
.
dtype
==
np
.
float16
or
self
.
dtype
==
"float16"
:
self
.
__class__
.
no_need_check_grad
=
True
x
=
np
.
random
.
random
(
self
.
x_shape
).
astype
(
self
.
dtype
)
y
=
np
.
random
.
random
(
self
.
y_shape
).
astype
(
self
.
dtype
)
# -0.1 ~ 0.1
...
...
@@ -99,6 +101,9 @@ class XPUTestMatmulV2Op(XPUOpTestWrapper):
self
.
check_output_with_place
(
place
)
def
test_check_grad
(
self
):
if
hasattr
(
self
.
__class__
,
"no_need_check_grad"
)
and
self
.
__class__
.
no_need_check_grad
==
True
:
return
place
=
paddle
.
XPUPlace
(
0
)
self
.
check_grad_with_place
(
place
,
[
'X'
,
'Y'
],
'Out'
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录