Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
2eac4db8
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看板
未验证
提交
2eac4db8
编写于
4月 15, 2022
作者:
Z
zhangxiaoci
提交者:
GitHub
4月 15, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support KL2 multi-card training, refactor KL2 unittest, *test=kunlun (#41543)
上级
35acfeda
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
274 addition
and
239 deletion
+274
-239
python/paddle/fluid/tests/unittests/xpu/test_squeeze2_op_xpu.py
.../paddle/fluid/tests/unittests/xpu/test_squeeze2_op_xpu.py
+71
-52
python/paddle/fluid/tests/unittests/xpu/test_unsqueeze2_op_xpu.py
...addle/fluid/tests/unittests/xpu/test_unsqueeze2_op_xpu.py
+203
-187
未找到文件。
python/paddle/fluid/tests/unittests/xpu/test_squeeze2_op_xpu.py
浏览文件 @
2eac4db8
...
...
@@ -21,67 +21,86 @@ import numpy as np
from
op_test
import
OpTest
from
op_test_xpu
import
XPUOpTest
from
xpu.get_test_cover_info
import
create_test_class
,
get_xpu_op_support_types
,
XPUOpTestWrapper
import
paddle
paddle
.
enable_static
()
# Correct: General.
class
TestSqueezeOp
(
XPUOpTest
):
def
setUp
(
self
):
self
.
op_type
=
"squeeze2"
self
.
use_xpu
=
True
self
.
use_mkldnn
=
False
self
.
init_test_case
()
self
.
inputs
=
{
"X"
:
np
.
random
.
random
(
self
.
ori_shape
).
astype
(
"float32"
)}
self
.
init_attrs
()
self
.
outputs
=
{
"Out"
:
self
.
inputs
[
"X"
].
reshape
(
self
.
new_shape
),
"XShape"
:
np
.
random
.
random
(
self
.
ori_shape
).
astype
(
"float32"
)
}
def
test_check_output
(
self
):
if
paddle
.
is_compiled_with_xpu
():
class
XPUTestSqueeze2Op
(
XPUOpTestWrapper
):
def
__init__
(
self
):
self
.
op_name
=
"squeeze2"
self
.
use_dynamic_create_class
=
False
class
TestSqueeze2Op
(
XPUOpTest
):
def
setUp
(
self
):
self
.
op_type
=
"squeeze2"
self
.
use_mkldnn
=
False
self
.
init_dtype
()
self
.
init_test_case
()
self
.
inputs
=
{
"X"
:
np
.
random
.
random
(
self
.
ori_shape
).
astype
(
self
.
dtype
)
}
self
.
outputs
=
{
"Out"
:
self
.
inputs
[
"X"
].
reshape
(
self
.
new_shape
),
"XShape"
:
np
.
random
.
random
(
self
.
ori_shape
).
astype
(
self
.
dtype
)
}
self
.
init_attrs
()
def
init_dtype
(
self
):
self
.
dtype
=
self
.
in_type
def
init_attrs
(
self
):
self
.
attrs
=
{
"axes"
:
self
.
axes
}
def
init_test_case
(
self
):
self
.
ori_shape
=
(
1
,
3
,
1
,
40
)
self
.
axes
=
(
0
,
2
)
self
.
new_shape
=
(
3
,
40
)
def
test_check_output
(
self
):
place
=
paddle
.
XPUPlace
(
0
)
self
.
check_output_with_place
(
place
,
no_check_set
=
[
'XShape'
])
def
test_check_grad
(
self
):
if
paddle
.
is_compiled_with_xpu
():
def
test_check_grad
(
self
):
place
=
paddle
.
XPUPlace
(
0
)
self
.
check_grad_with_place
(
place
,
[
'X'
],
'Out'
)
def
init_test_case
(
self
):
self
.
ori_shape
=
(
1
,
3
,
1
,
40
)
self
.
axes
=
(
0
,
2
)
self
.
new_shape
=
(
3
,
40
)
def
init_attrs
(
self
):
self
.
attrs
=
{
"axes"
:
self
.
axes
}
# Correct: There is mins axis.
class
TestSqueezeOp1
(
TestSqueezeOp
):
def
init_test_case
(
self
):
self
.
ori_shape
=
(
1
,
20
,
1
,
5
)
self
.
axes
=
(
0
,
-
2
)
self
.
new_shape
=
(
20
,
5
)
# Correct: No axes input.
class
TestSqueezeOp2
(
TestSqueezeOp
):
def
init_test_case
(
self
):
self
.
ori_shape
=
(
1
,
20
,
1
,
5
)
self
.
axes
=
()
self
.
new_shape
=
(
20
,
5
)
# Correct: Just part of axes be squeezed.
class
TestSqueezeOp3
(
TestSqueezeOp
):
def
init_test_case
(
self
):
self
.
ori_shape
=
(
6
,
1
,
5
,
1
,
4
,
1
)
self
.
axes
=
(
1
,
-
1
)
self
.
new_shape
=
(
6
,
5
,
1
,
4
)
if
self
.
dtype
in
[
np
.
float32
,
np
.
float64
]:
self
.
check_grad_with_place
(
place
,
[
'X'
],
'Out'
)
elif
self
.
dtype
==
np
.
bool_
:
return
else
:
user_defined_grad_outputs
=
np
.
random
.
random
(
self
.
new_shape
).
astype
(
self
.
dtype
)
self
.
check_grad_with_place
(
place
,
[
'X'
],
'Out'
,
user_defined_grad_outputs
=
user_defined_grad_outputs
)
# Correct: There is mins axis.
class
TestSqueeze2Op1
(
TestSqueeze2Op
):
def
init_test_case
(
self
):
self
.
ori_shape
=
(
1
,
20
,
1
,
5
)
self
.
axes
=
(
0
,
-
2
)
self
.
new_shape
=
(
20
,
5
)
# Correct: No axes input.
class
TestSqueeze2Op2
(
TestSqueeze2Op
):
def
init_test_case
(
self
):
self
.
ori_shape
=
(
1
,
20
,
1
,
5
)
self
.
axes
=
()
self
.
new_shape
=
(
20
,
5
)
# Correct: Just part of axes be squeezed.
class
TestSqueeze2Op3
(
TestSqueeze2Op
):
def
init_test_case
(
self
):
self
.
ori_shape
=
(
6
,
1
,
5
,
1
,
4
,
1
)
self
.
axes
=
(
1
,
-
1
)
self
.
new_shape
=
(
6
,
5
,
1
,
4
)
support_types
=
get_xpu_op_support_types
(
"squeeze2"
)
for
stype
in
support_types
:
create_test_class
(
globals
(),
XPUTestSqueeze2Op
,
stype
)
if
__name__
==
"__main__"
:
unittest
.
main
()
python/paddle/fluid/tests/unittests/xpu/test_unsqueeze2_op_xpu.py
浏览文件 @
2eac4db8
...
...
@@ -23,209 +23,225 @@ import paddle
import
paddle.fluid
as
fluid
from
op_test
import
OpTest
from
op_test_xpu
import
XPUOpTest
from
xpu.get_test_cover_info
import
create_test_class
,
get_xpu_op_support_types
,
XPUOpTestWrapper
paddle
.
enable_static
()
# Correct: General.
class
TestUnsqueezeOp
(
XPUOpTest
):
def
setUp
(
self
):
self
.
init_test_case
()
self
.
use_xpu
=
True
self
.
use_mkldnn
=
False
self
.
op_type
=
"unsqueeze2"
self
.
inputs
=
{
"X"
:
np
.
random
.
random
(
self
.
ori_shape
).
astype
(
"float32"
)}
self
.
init_attrs
()
self
.
outputs
=
{
"Out"
:
self
.
inputs
[
"X"
].
reshape
(
self
.
new_shape
),
"XShape"
:
np
.
random
.
random
(
self
.
ori_shape
).
astype
(
"float32"
)
}
def
test_check_output
(
self
):
if
paddle
.
is_compiled_with_xpu
():
class
XPUTestUnsqueeze2Op
(
XPUOpTestWrapper
):
def
__init__
(
self
):
self
.
op_name
=
"unsqueeze2"
self
.
use_dynamic_create_class
=
False
class
TestUnsqueeze2Op
(
XPUOpTest
):
def
setUp
(
self
):
self
.
op_type
=
"unsqueeze2"
self
.
use_mkldnn
=
False
self
.
init_dtype
()
self
.
init_test_case
()
self
.
inputs
=
{
"X"
:
np
.
random
.
random
(
self
.
ori_shape
).
astype
(
self
.
dtype
)
}
self
.
outputs
=
{
"Out"
:
self
.
inputs
[
"X"
].
reshape
(
self
.
new_shape
),
"XShape"
:
np
.
random
.
random
(
self
.
ori_shape
).
astype
(
self
.
dtype
)
}
self
.
init_attrs
()
def
init_dtype
(
self
):
self
.
dtype
=
self
.
in_type
def
init_attrs
(
self
):
self
.
attrs
=
{
"axes"
:
self
.
axes
}
def
init_test_case
(
self
):
self
.
ori_shape
=
(
3
,
40
)
self
.
axes
=
(
1
,
2
)
self
.
new_shape
=
(
3
,
1
,
1
,
40
)
def
test_check_output
(
self
):
place
=
paddle
.
XPUPlace
(
0
)
self
.
check_output_with_place
(
place
,
no_check_set
=
[
'XShape'
])
def
test_check_grad
(
self
):
if
paddle
.
is_compiled_with_xpu
():
def
test_check_grad
(
self
):
place
=
paddle
.
XPUPlace
(
0
)
self
.
check_grad_with_place
(
place
,
[
'X'
],
'Out'
)
def
init_test_case
(
self
):
self
.
ori_shape
=
(
3
,
40
)
self
.
axes
=
(
1
,
2
)
self
.
new_shape
=
(
3
,
1
,
1
,
40
)
def
init_attrs
(
self
):
self
.
attrs
=
{
"axes"
:
self
.
axes
}
# Correct: Single input index.
class
TestUnsqueezeOp1
(
TestUnsqueezeOp
):
def
init_test_case
(
self
):
self
.
ori_shape
=
(
20
,
5
)
self
.
axes
=
(
-
1
,
)
self
.
new_shape
=
(
20
,
5
,
1
)
# Correct: Mixed input axis.
class
TestUnsqueezeOp2
(
TestUnsqueezeOp
):
def
init_test_case
(
self
):
self
.
ori_shape
=
(
20
,
5
)
self
.
axes
=
(
0
,
-
1
)
self
.
new_shape
=
(
1
,
20
,
5
,
1
)
# Correct: There is duplicated axis.
class
TestUnsqueezeOp3
(
TestUnsqueezeOp
):
def
init_test_case
(
self
):
self
.
ori_shape
=
(
10
,
2
,
5
)
self
.
axes
=
(
0
,
3
,
3
)
self
.
new_shape
=
(
1
,
10
,
2
,
1
,
1
,
5
)
# Correct: Reversed axes.
class
TestUnsqueezeOp4
(
TestUnsqueezeOp
):
def
init_test_case
(
self
):
self
.
ori_shape
=
(
10
,
2
,
5
)
self
.
axes
=
(
3
,
1
,
1
)
self
.
new_shape
=
(
10
,
1
,
1
,
2
,
5
,
1
)
# axes is a list(with tensor)
class
TestUnsqueezeOp_AxesTensorList
(
XPUOpTest
):
def
setUp
(
self
):
self
.
init_test_case
()
self
.
use_xpu
=
True
self
.
use_mkldnn
=
False
self
.
op_type
=
"unsqueeze2"
axes_tensor_list
=
[]
for
index
,
ele
in
enumerate
(
self
.
axes
):
axes_tensor_list
.
append
((
"axes"
+
str
(
index
),
np
.
ones
(
(
1
)).
astype
(
'int32'
)
*
ele
))
self
.
inputs
=
{
"X"
:
np
.
random
.
random
(
self
.
ori_shape
).
astype
(
"float32"
),
"AxesTensorList"
:
axes_tensor_list
}
self
.
init_attrs
()
self
.
outputs
=
{
"Out"
:
self
.
inputs
[
"X"
].
reshape
(
self
.
new_shape
),
"XShape"
:
np
.
random
.
random
(
self
.
ori_shape
).
astype
(
"float32"
)
}
def
test_check_output
(
self
):
if
paddle
.
is_compiled_with_xpu
():
if
self
.
dtype
in
[
np
.
float32
,
np
.
float64
]:
self
.
check_grad_with_place
(
place
,
[
'X'
],
'Out'
)
elif
self
.
dtype
==
np
.
bool_
:
return
else
:
user_defined_grad_outputs
=
np
.
random
.
random
(
self
.
new_shape
).
astype
(
self
.
dtype
)
self
.
check_grad_with_place
(
place
,
[
'X'
],
'Out'
,
user_defined_grad_outputs
=
user_defined_grad_outputs
)
# Correct: Single input index.
class
TestUnsqueeze2Op1
(
TestUnsqueeze2Op
):
def
init_test_case
(
self
):
self
.
ori_shape
=
(
20
,
5
)
self
.
axes
=
(
-
1
,
)
self
.
new_shape
=
(
20
,
5
,
1
)
# Correct: Mixed input axis.
class
TestUnsqueeze2Op2
(
TestUnsqueeze2Op
):
def
init_test_case
(
self
):
self
.
ori_shape
=
(
20
,
5
)
self
.
axes
=
(
0
,
-
1
)
self
.
new_shape
=
(
1
,
20
,
5
,
1
)
# Correct: There is duplicated axis.
class
TestUnsqueeze2Op3
(
TestUnsqueeze2Op
):
def
init_test_case
(
self
):
self
.
ori_shape
=
(
10
,
2
,
5
)
self
.
axes
=
(
0
,
3
,
3
)
self
.
new_shape
=
(
1
,
10
,
2
,
1
,
1
,
5
)
# Correct: Reversed axes.
class
TestUnsqueeze2Op4
(
TestUnsqueeze2Op
):
def
init_test_case
(
self
):
self
.
ori_shape
=
(
10
,
2
,
5
)
self
.
axes
=
(
3
,
1
,
1
)
self
.
new_shape
=
(
10
,
1
,
1
,
2
,
5
,
1
)
# axes is a list(with tensor)
class
TestUnsqueeze2Op_AxesTensorList
(
XPUOpTest
):
def
setUp
(
self
):
self
.
op_type
=
"unsqueeze2"
self
.
use_mkldnn
=
False
self
.
init_dtype
()
self
.
init_test_case
()
axes_tensor_list
=
[]
for
index
,
ele
in
enumerate
(
self
.
axes
):
axes_tensor_list
.
append
((
"axes"
+
str
(
index
),
np
.
ones
(
(
1
)).
astype
(
'int32'
)
*
ele
))
self
.
inputs
=
{
"X"
:
np
.
random
.
random
(
self
.
ori_shape
).
astype
(
self
.
dtype
),
"AxesTensorList"
:
axes_tensor_list
}
self
.
init_attrs
()
self
.
outputs
=
{
"Out"
:
self
.
inputs
[
"X"
].
reshape
(
self
.
new_shape
),
"XShape"
:
np
.
random
.
random
(
self
.
ori_shape
).
astype
(
self
.
dtype
)
}
def
init_dtype
(
self
):
self
.
dtype
=
self
.
in_type
def
test_check_output
(
self
):
place
=
paddle
.
XPUPlace
(
0
)
self
.
check_output_with_place
(
place
,
no_check_set
=
[
'XShape'
])
def
test_check_grad
(
self
):
if
paddle
.
is_compiled_with_xpu
():
def
test_check_grad
(
self
):
place
=
paddle
.
XPUPlace
(
0
)
self
.
check_grad_with_place
(
place
,
[
'X'
],
'Out'
)
def
init_test_case
(
self
)
:
self
.
ori_shape
=
(
20
,
5
)
self
.
axes
=
(
1
,
2
)
self
.
new_shape
=
(
20
,
1
,
1
,
5
)
def
init_attrs
(
self
):
self
.
attrs
=
{}
class
TestUnsqueezeOp1_AxesTensorList
(
TestUnsqueezeOp_AxesTensorList
):
def
init_test_case
(
self
):
self
.
ori_shape
=
(
20
,
5
)
self
.
axes
=
(
-
1
,
)
self
.
new_shape
=
(
20
,
5
,
1
)
class
TestUnsqueezeOp2_AxesTensorList
(
TestUnsqueezeOp_AxesTensorList
):
def
init_test_case
(
self
):
self
.
ori_shape
=
(
20
,
5
)
self
.
axes
=
(
0
,
-
1
)
self
.
new_shape
=
(
1
,
20
,
5
,
1
)
class
TestUnsqueezeOp3_AxesTensorList
(
TestUnsqueeze
Op_AxesTensorList
):
def
init_test_case
(
self
):
self
.
ori_shape
=
(
10
,
2
,
5
)
self
.
axes
=
(
0
,
3
,
3
)
self
.
new_shape
=
(
1
,
10
,
2
,
1
,
1
,
5
)
class
TestUnsqueezeOp4_AxesTensorList
(
TestUnsqueezeOp_AxesTensorList
):
def
init_test_case
(
self
):
self
.
ori_shape
=
(
10
,
2
,
5
)
self
.
axes
=
(
3
,
1
,
1
)
self
.
new_shape
=
(
10
,
1
,
1
,
2
,
5
,
1
)
# axes is a Tensor
class
TestUnsqueezeOp_AxesTensor
(
XPUOpTest
):
def
setUp
(
self
):
self
.
init_test_case
()
self
.
use_xpu
=
True
self
.
use_mkldnn
=
False
self
.
op_type
=
"unsqueeze2"
self
.
inputs
=
{
"X"
:
np
.
random
.
random
(
self
.
ori_shape
).
astype
(
"float32"
),
"AxesTensor"
:
np
.
array
(
self
.
axes
).
astype
(
"int32"
)
}
self
.
init_attrs
()
self
.
outputs
=
{
"Out"
:
self
.
inputs
[
"X"
].
reshape
(
self
.
new_shape
),
"XShape"
:
np
.
random
.
random
(
self
.
ori_shape
).
astype
(
"float32"
)
}
def
test_check_output
(
self
):
if
paddle
.
is_compiled_with_xpu
(
):
if
self
.
dtype
in
[
np
.
float32
,
np
.
float64
]:
self
.
check_grad_with_place
(
place
,
[
'X'
],
'Out'
)
else
:
return
def
init_test_case
(
self
):
self
.
ori_shape
=
(
20
,
5
)
self
.
axes
=
(
1
,
2
)
self
.
new_shape
=
(
20
,
1
,
1
,
5
)
def
init_attrs
(
self
):
self
.
attrs
=
{}
class
TestUnsqueeze2Op1_AxesTensorList
(
TestUnsqueeze2Op_AxesTensorList
):
def
init_test_case
(
self
):
self
.
ori_shape
=
(
20
,
5
)
self
.
axes
=
(
-
1
,
)
self
.
new_shape
=
(
20
,
5
,
1
)
class
TestUnsqueeze2Op2_AxesTensorList
(
TestUnsqueeze2Op_AxesTensorList
):
def
init_test_case
(
self
):
self
.
ori_shape
=
(
20
,
5
)
self
.
axes
=
(
0
,
-
1
)
self
.
new_shape
=
(
1
,
20
,
5
,
1
)
class
TestUnsqueeze2Op3_AxesTensorList
(
TestUnsqueeze2
Op_AxesTensorList
):
def
init_test_case
(
self
):
self
.
ori_shape
=
(
10
,
2
,
5
)
self
.
axes
=
(
0
,
3
,
3
)
self
.
new_shape
=
(
1
,
10
,
2
,
1
,
1
,
5
)
class
TestUnsqueeze2Op4_AxesTensorList
(
TestUnsqueeze2Op_AxesTensorList
):
def
init_test_case
(
self
):
self
.
ori_shape
=
(
10
,
2
,
5
)
self
.
axes
=
(
3
,
1
,
1
)
self
.
new_shape
=
(
10
,
1
,
1
,
2
,
5
,
1
)
# axes is a Tensor
class
TestUnsqueeze2Op_AxesTensor
(
XPUOpTest
):
def
setUp
(
self
):
self
.
op_type
=
"unsqueeze2"
self
.
use_mkldnn
=
False
self
.
init_test_case
()
self
.
init_dtype
()
self
.
inputs
=
{
"X"
:
np
.
random
.
random
(
self
.
ori_shape
).
astype
(
self
.
dtype
),
"AxesTensor"
:
np
.
array
(
self
.
axes
).
astype
(
"int32"
)
}
self
.
init_attrs
(
)
self
.
outputs
=
{
"Out"
:
self
.
inputs
[
"X"
].
reshape
(
self
.
new_shape
),
"XShape"
:
np
.
random
.
random
(
self
.
ori_shape
).
astype
(
self
.
dtype
)
}
def
init_dtype
(
self
):
self
.
dtype
=
self
.
in_type
def
test_check_output
(
self
):
place
=
paddle
.
XPUPlace
(
0
)
self
.
check_output_with_place
(
place
,
no_check_set
=
[
'XShape'
])
def
test_check_grad
(
self
):
if
paddle
.
is_compiled_with_xpu
():
def
test_check_grad
(
self
):
place
=
paddle
.
XPUPlace
(
0
)
self
.
check_grad_with_place
(
place
,
[
'X'
],
'Out'
)
def
init_test_case
(
self
):
self
.
ori_shape
=
(
20
,
5
)
self
.
axes
=
(
1
,
2
)
self
.
new_shape
=
(
20
,
1
,
1
,
5
)
def
init_attrs
(
self
):
self
.
attrs
=
{}
class
TestUnsqueezeOp1_AxesTensor
(
TestUnsqueezeOp_AxesTensor
):
def
init_test_case
(
self
):
self
.
ori_shape
=
(
20
,
5
)
self
.
axes
=
(
-
1
,
)
self
.
new_shape
=
(
20
,
5
,
1
)
class
TestUnsqueezeOp2_AxesTensor
(
TestUnsqueezeOp_AxesTensor
):
def
init_test_case
(
self
):
self
.
ori_shape
=
(
20
,
5
)
self
.
axes
=
(
0
,
-
1
)
self
.
new_shape
=
(
1
,
20
,
5
,
1
)
class
TestUnsqueezeOp3_AxesTensor
(
TestUnsqueezeOp_AxesTensor
):
def
init_test_case
(
self
):
self
.
ori_shape
=
(
10
,
2
,
5
)
self
.
axes
=
(
0
,
3
,
3
)
self
.
new_shape
=
(
1
,
10
,
2
,
1
,
1
,
5
)
class
TestUnsqueezeOp4_AxesTensor
(
TestUnsqueezeOp_AxesTensor
):
def
init_test_case
(
self
):
self
.
ori_shape
=
(
10
,
2
,
5
)
self
.
axes
=
(
3
,
1
,
1
)
self
.
new_shape
=
(
10
,
1
,
1
,
2
,
5
,
1
)
if
self
.
dtype
in
[
np
.
float32
,
np
.
float64
]:
self
.
check_grad_with_place
(
place
,
[
'X'
],
'Out'
)
else
:
return
def
init_test_case
(
self
):
self
.
ori_shape
=
(
20
,
5
)
self
.
axes
=
(
1
,
2
)
self
.
new_shape
=
(
20
,
1
,
1
,
5
)
def
init_attrs
(
self
):
self
.
attrs
=
{}
class
TestUnsqueeze2Op1_AxesTensor
(
TestUnsqueeze2Op_AxesTensor
):
def
init_test_case
(
self
):
self
.
ori_shape
=
(
20
,
5
)
self
.
axes
=
(
-
1
,
)
self
.
new_shape
=
(
20
,
5
,
1
)
class
TestUnsqueeze2Op2_AxesTensor
(
TestUnsqueeze2Op_AxesTensor
):
def
init_test_case
(
self
):
self
.
ori_shape
=
(
20
,
5
)
self
.
axes
=
(
0
,
-
1
)
self
.
new_shape
=
(
1
,
20
,
5
,
1
)
class
TestUnsqueeze2Op3_AxesTensor
(
TestUnsqueeze2Op_AxesTensor
):
def
init_test_case
(
self
):
self
.
ori_shape
=
(
10
,
2
,
5
)
self
.
axes
=
(
0
,
3
,
3
)
self
.
new_shape
=
(
1
,
10
,
2
,
1
,
1
,
5
)
class
TestUnsqueeze2Op4_AxesTensor
(
TestUnsqueeze2Op_AxesTensor
):
def
init_test_case
(
self
):
self
.
ori_shape
=
(
10
,
2
,
5
)
self
.
axes
=
(
3
,
1
,
1
)
self
.
new_shape
=
(
10
,
1
,
1
,
2
,
5
,
1
)
support_types
=
get_xpu_op_support_types
(
"unsqueeze2"
)
for
stype
in
support_types
:
create_test_class
(
globals
(),
XPUTestUnsqueeze2Op
,
stype
)
if
__name__
==
"__main__"
:
unittest
.
main
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录