Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
0530358f
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2305
Star
20932
Fork
5423
代码
文件
提交
分支
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看板
未验证
提交
0530358f
编写于
3月 13, 2023
作者:
J
jiangcheng
提交者:
GitHub
3月 13, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[CINN] reopen elementwise_div/cumsum prim+cinn unittest (#51465)
上级
1d992173
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
17 addition
and
20 deletion
+17
-20
python/paddle/fluid/tests/unittests/test_cumsum_op.py
python/paddle/fluid/tests/unittests/test_cumsum_op.py
+12
-12
python/paddle/fluid/tests/unittests/test_elementwise_div_op.py
...n/paddle/fluid/tests/unittests/test_elementwise_div_op.py
+5
-8
未找到文件。
python/paddle/fluid/tests/unittests/test_cumsum_op.py
浏览文件 @
0530358f
...
@@ -117,7 +117,7 @@ class TestSumOp1(OpTest):
...
@@ -117,7 +117,7 @@ class TestSumOp1(OpTest):
self
.
op_type
=
"cumsum"
self
.
op_type
=
"cumsum"
self
.
prim_op_type
=
"prim"
self
.
prim_op_type
=
"prim"
self
.
python_api
=
paddle
.
cumsum
self
.
python_api
=
paddle
.
cumsum
self
.
enable_cinn
=
Fals
e
self
.
enable_cinn
=
Tru
e
self
.
attrs
=
{
'axis'
:
2
}
self
.
attrs
=
{
'axis'
:
2
}
self
.
inputs
=
{
'X'
:
np
.
random
.
random
((
5
,
6
,
10
)).
astype
(
"float64"
)}
self
.
inputs
=
{
'X'
:
np
.
random
.
random
((
5
,
6
,
10
)).
astype
(
"float64"
)}
self
.
outputs
=
{
'Out'
:
self
.
inputs
[
'X'
].
cumsum
(
axis
=
2
)}
self
.
outputs
=
{
'Out'
:
self
.
inputs
[
'X'
].
cumsum
(
axis
=
2
)}
...
@@ -134,7 +134,7 @@ class TestSumOp2(OpTest):
...
@@ -134,7 +134,7 @@ class TestSumOp2(OpTest):
self
.
op_type
=
"cumsum"
self
.
op_type
=
"cumsum"
self
.
prim_op_type
=
"prim"
self
.
prim_op_type
=
"prim"
self
.
python_api
=
paddle
.
cumsum
self
.
python_api
=
paddle
.
cumsum
self
.
enable_cinn
=
Fals
e
self
.
enable_cinn
=
Tru
e
self
.
attrs
=
{
'axis'
:
-
1
,
'reverse'
:
True
}
self
.
attrs
=
{
'axis'
:
-
1
,
'reverse'
:
True
}
self
.
inputs
=
{
'X'
:
np
.
random
.
random
((
5
,
6
,
10
)).
astype
(
"float64"
)}
self
.
inputs
=
{
'X'
:
np
.
random
.
random
((
5
,
6
,
10
)).
astype
(
"float64"
)}
self
.
outputs
=
{
self
.
outputs
=
{
...
@@ -155,7 +155,7 @@ class TestSumOp3(OpTest):
...
@@ -155,7 +155,7 @@ class TestSumOp3(OpTest):
self
.
op_type
=
"cumsum"
self
.
op_type
=
"cumsum"
self
.
prim_op_type
=
"prim"
self
.
prim_op_type
=
"prim"
self
.
python_api
=
paddle
.
cumsum
self
.
python_api
=
paddle
.
cumsum
self
.
enable_cinn
=
Fals
e
self
.
enable_cinn
=
Tru
e
self
.
attrs
=
{
'axis'
:
1
}
self
.
attrs
=
{
'axis'
:
1
}
self
.
inputs
=
{
'X'
:
np
.
random
.
random
((
5
,
6
,
10
)).
astype
(
"float64"
)}
self
.
inputs
=
{
'X'
:
np
.
random
.
random
((
5
,
6
,
10
)).
astype
(
"float64"
)}
self
.
outputs
=
{
'Out'
:
self
.
inputs
[
'X'
].
cumsum
(
axis
=
1
)}
self
.
outputs
=
{
'Out'
:
self
.
inputs
[
'X'
].
cumsum
(
axis
=
1
)}
...
@@ -172,7 +172,7 @@ class TestSumOp4(OpTest):
...
@@ -172,7 +172,7 @@ class TestSumOp4(OpTest):
self
.
op_type
=
"cumsum"
self
.
op_type
=
"cumsum"
self
.
prim_op_type
=
"prim"
self
.
prim_op_type
=
"prim"
self
.
python_api
=
paddle
.
cumsum
self
.
python_api
=
paddle
.
cumsum
self
.
enable_cinn
=
Fals
e
self
.
enable_cinn
=
Tru
e
self
.
attrs
=
{
'axis'
:
0
}
self
.
attrs
=
{
'axis'
:
0
}
self
.
inputs
=
{
'X'
:
np
.
random
.
random
((
5
,
6
,
10
)).
astype
(
"float64"
)}
self
.
inputs
=
{
'X'
:
np
.
random
.
random
((
5
,
6
,
10
)).
astype
(
"float64"
)}
self
.
outputs
=
{
'Out'
:
self
.
inputs
[
'X'
].
cumsum
(
axis
=
0
)}
self
.
outputs
=
{
'Out'
:
self
.
inputs
[
'X'
].
cumsum
(
axis
=
0
)}
...
@@ -189,7 +189,7 @@ class TestSumOp5(OpTest):
...
@@ -189,7 +189,7 @@ class TestSumOp5(OpTest):
self
.
op_type
=
"cumsum"
self
.
op_type
=
"cumsum"
self
.
prim_op_type
=
"prim"
self
.
prim_op_type
=
"prim"
self
.
python_api
=
paddle
.
cumsum
self
.
python_api
=
paddle
.
cumsum
self
.
enable_cinn
=
Fals
e
self
.
enable_cinn
=
Tru
e
self
.
inputs
=
{
'X'
:
np
.
random
.
random
((
5
,
20
)).
astype
(
"float64"
)}
self
.
inputs
=
{
'X'
:
np
.
random
.
random
((
5
,
20
)).
astype
(
"float64"
)}
self
.
outputs
=
{
'Out'
:
self
.
inputs
[
'X'
].
cumsum
(
axis
=
1
)}
self
.
outputs
=
{
'Out'
:
self
.
inputs
[
'X'
].
cumsum
(
axis
=
1
)}
...
@@ -222,7 +222,7 @@ class TestSumOp7(OpTest):
...
@@ -222,7 +222,7 @@ class TestSumOp7(OpTest):
self
.
op_type
=
"cumsum"
self
.
op_type
=
"cumsum"
self
.
prim_op_type
=
"prim"
self
.
prim_op_type
=
"prim"
self
.
python_api
=
paddle
.
cumsum
self
.
python_api
=
paddle
.
cumsum
self
.
enable_cinn
=
Fals
e
self
.
enable_cinn
=
Tru
e
self
.
inputs
=
{
'X'
:
np
.
random
.
random
((
100
)).
astype
(
"float64"
)}
self
.
inputs
=
{
'X'
:
np
.
random
.
random
((
100
)).
astype
(
"float64"
)}
self
.
outputs
=
{
'Out'
:
self
.
inputs
[
'X'
].
cumsum
(
axis
=
0
)}
self
.
outputs
=
{
'Out'
:
self
.
inputs
[
'X'
].
cumsum
(
axis
=
0
)}
...
@@ -263,7 +263,7 @@ class TestSumOpExclusive1(OpTest):
...
@@ -263,7 +263,7 @@ class TestSumOpExclusive1(OpTest):
self
.
op_type
=
"cumsum"
self
.
op_type
=
"cumsum"
self
.
prim_op_type
=
"prim"
self
.
prim_op_type
=
"prim"
self
.
python_api
=
paddle
.
cumsum
self
.
python_api
=
paddle
.
cumsum
self
.
enable_cinn
=
Fals
e
self
.
enable_cinn
=
Tru
e
self
.
attrs
=
{
'axis'
:
2
,
"exclusive"
:
True
}
self
.
attrs
=
{
'axis'
:
2
,
"exclusive"
:
True
}
a
=
np
.
random
.
random
((
4
,
5
,
20
)).
astype
(
"float64"
)
a
=
np
.
random
.
random
((
4
,
5
,
20
)).
astype
(
"float64"
)
self
.
inputs
=
{
'X'
:
a
}
self
.
inputs
=
{
'X'
:
a
}
...
@@ -289,7 +289,7 @@ class TestSumOpExclusive2(OpTest):
...
@@ -289,7 +289,7 @@ class TestSumOpExclusive2(OpTest):
self
.
op_type
=
"cumsum"
self
.
op_type
=
"cumsum"
self
.
prim_op_type
=
"prim"
self
.
prim_op_type
=
"prim"
self
.
python_api
=
paddle
.
cumsum
self
.
python_api
=
paddle
.
cumsum
self
.
enable_cinn
=
Fals
e
self
.
enable_cinn
=
Tru
e
self
.
attrs
=
{
'axis'
:
2
,
"exclusive"
:
True
}
self
.
attrs
=
{
'axis'
:
2
,
"exclusive"
:
True
}
a
=
np
.
random
.
random
((
1
,
1
,
100
)).
astype
(
"float64"
)
a
=
np
.
random
.
random
((
1
,
1
,
100
)).
astype
(
"float64"
)
self
.
inputs
=
{
'X'
:
a
}
self
.
inputs
=
{
'X'
:
a
}
...
@@ -315,7 +315,7 @@ class TestSumOpExclusive3(OpTest):
...
@@ -315,7 +315,7 @@ class TestSumOpExclusive3(OpTest):
self
.
op_type
=
"cumsum"
self
.
op_type
=
"cumsum"
self
.
prim_op_type
=
"prim"
self
.
prim_op_type
=
"prim"
self
.
python_api
=
paddle
.
cumsum
self
.
python_api
=
paddle
.
cumsum
self
.
enable_cinn
=
Fals
e
self
.
enable_cinn
=
Tru
e
self
.
attrs
=
{
'axis'
:
2
,
"exclusive"
:
True
}
self
.
attrs
=
{
'axis'
:
2
,
"exclusive"
:
True
}
a
=
np
.
random
.
random
((
4
,
5
,
20
)).
astype
(
"float64"
)
a
=
np
.
random
.
random
((
4
,
5
,
20
)).
astype
(
"float64"
)
self
.
inputs
=
{
'X'
:
a
}
self
.
inputs
=
{
'X'
:
a
}
...
@@ -341,7 +341,7 @@ class TestSumOpExclusive4(OpTest):
...
@@ -341,7 +341,7 @@ class TestSumOpExclusive4(OpTest):
self
.
op_type
=
"cumsum"
self
.
op_type
=
"cumsum"
self
.
prim_op_type
=
"prim"
self
.
prim_op_type
=
"prim"
self
.
python_api
=
paddle
.
cumsum
self
.
python_api
=
paddle
.
cumsum
self
.
enable_cinn
=
Fals
e
self
.
enable_cinn
=
Tru
e
self
.
attrs
=
{
'axis'
:
2
,
"exclusive"
:
True
}
self
.
attrs
=
{
'axis'
:
2
,
"exclusive"
:
True
}
a
=
np
.
random
.
random
((
1
,
1
,
100
)).
astype
(
"float64"
)
a
=
np
.
random
.
random
((
1
,
1
,
100
)).
astype
(
"float64"
)
self
.
inputs
=
{
'X'
:
a
}
self
.
inputs
=
{
'X'
:
a
}
...
@@ -367,7 +367,7 @@ class TestSumOpExclusive5(OpTest):
...
@@ -367,7 +367,7 @@ class TestSumOpExclusive5(OpTest):
self
.
op_type
=
"cumsum"
self
.
op_type
=
"cumsum"
self
.
prim_op_type
=
"prim"
self
.
prim_op_type
=
"prim"
self
.
python_api
=
paddle
.
cumsum
self
.
python_api
=
paddle
.
cumsum
self
.
enable_cinn
=
Fals
e
self
.
enable_cinn
=
Tru
e
self
.
attrs
=
{
'axis'
:
2
,
"exclusive"
:
True
}
self
.
attrs
=
{
'axis'
:
2
,
"exclusive"
:
True
}
a
=
np
.
random
.
random
((
4
,
5
,
40
)).
astype
(
"float64"
)
a
=
np
.
random
.
random
((
4
,
5
,
40
)).
astype
(
"float64"
)
self
.
inputs
=
{
'X'
:
a
}
self
.
inputs
=
{
'X'
:
a
}
...
@@ -419,7 +419,7 @@ class TestSumOpReverseExclusive(OpTest):
...
@@ -419,7 +419,7 @@ class TestSumOpReverseExclusive(OpTest):
self
.
op_type
=
"cumsum"
self
.
op_type
=
"cumsum"
self
.
prim_op_type
=
"prim"
self
.
prim_op_type
=
"prim"
self
.
python_api
=
paddle
.
cumsum
self
.
python_api
=
paddle
.
cumsum
self
.
enable_cinn
=
Fals
e
self
.
enable_cinn
=
Tru
e
self
.
attrs
=
{
'axis'
:
2
,
'reverse'
:
True
,
"exclusive"
:
True
}
self
.
attrs
=
{
'axis'
:
2
,
'reverse'
:
True
,
"exclusive"
:
True
}
a
=
np
.
random
.
random
((
4
,
5
,
6
)).
astype
(
"float64"
)
a
=
np
.
random
.
random
((
4
,
5
,
6
)).
astype
(
"float64"
)
self
.
inputs
=
{
'X'
:
a
}
self
.
inputs
=
{
'X'
:
a
}
...
...
python/paddle/fluid/tests/unittests/test_elementwise_div_op.py
浏览文件 @
0530358f
...
@@ -65,7 +65,7 @@ class ElementwiseDivOp(OpTest):
...
@@ -65,7 +65,7 @@ class ElementwiseDivOp(OpTest):
self
.
grad_y
=
grad_y
self
.
grad_y
=
grad_y
def
if_enable_cinn
(
self
):
def
if_enable_cinn
(
self
):
pass
self
.
enable_cinn
=
True
def
init_args
(
self
):
def
init_args
(
self
):
self
.
check_dygraph
=
True
self
.
check_dygraph
=
True
...
@@ -136,9 +136,6 @@ class TestElementwiseDivPrimOpFp32(ElementwiseDivOp):
...
@@ -136,9 +136,6 @@ class TestElementwiseDivPrimOpFp32(ElementwiseDivOp):
self
.
dtype
=
np
.
float32
self
.
dtype
=
np
.
float32
self
.
val_dtype
=
np
.
float32
self
.
val_dtype
=
np
.
float32
def
if_enable_cinn
(
self
):
pass
class
TestElementwiseDivOp_ZeroDim1
(
ElementwiseDivOp
):
class
TestElementwiseDivOp_ZeroDim1
(
ElementwiseDivOp
):
def
init_shape
(
self
):
def
init_shape
(
self
):
...
@@ -208,6 +205,9 @@ class TestElementwiseDivOpBF16(ElementwiseDivOp):
...
@@ -208,6 +205,9 @@ class TestElementwiseDivOpBF16(ElementwiseDivOp):
def
if_check_prim
(
self
):
def
if_check_prim
(
self
):
self
.
check_prim
=
False
self
.
check_prim
=
False
def
if_enable_cinn
(
self
):
self
.
enable_cinn
=
False
@
skip_check_grad_ci
(
@
skip_check_grad_ci
(
reason
=
"[skip shape check] Use y_shape(1) to test broadcast."
reason
=
"[skip shape check] Use y_shape(1) to test broadcast."
...
@@ -375,9 +375,6 @@ class TestElementwiseDivOpXsizeLessThanYsize(ElementwiseDivOp):
...
@@ -375,9 +375,6 @@ class TestElementwiseDivOpXsizeLessThanYsize(ElementwiseDivOp):
def
compute_gradient_x
(
self
,
grad_out
,
y
):
def
compute_gradient_x
(
self
,
grad_out
,
y
):
return
np
.
sum
(
grad_out
/
y
,
axis
=
(
0
,
1
))
return
np
.
sum
(
grad_out
/
y
,
axis
=
(
0
,
1
))
def
if_enable_cinn
(
self
):
self
.
enable_cinn
=
False
class
TestElementwiseDivOpInt
(
ElementwiseDivOp
):
class
TestElementwiseDivOpInt
(
ElementwiseDivOp
):
def
init_dtype
(
self
):
def
init_dtype
(
self
):
...
@@ -400,7 +397,7 @@ class TestElementwiseDivOpFp16(ElementwiseDivOp):
...
@@ -400,7 +397,7 @@ class TestElementwiseDivOpFp16(ElementwiseDivOp):
self
.
val_dtype
=
np
.
float16
self
.
val_dtype
=
np
.
float16
def
if_enable_cinn
(
self
):
def
if_enable_cinn
(
self
):
self
.
enable_cinn
=
Fals
e
self
.
enable_cinn
=
Tru
e
class
TestElementwiseDivBroadcast
(
unittest
.
TestCase
):
class
TestElementwiseDivBroadcast
(
unittest
.
TestCase
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录