Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
14e0ce71
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2302
Star
20931
Fork
5422
代码
文件
提交
分支
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看板
未验证
提交
14e0ce71
编写于
5月 19, 2023
作者:
C
Charles-hit
提交者:
GitHub
5月 19, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix meshgird and expand_as test (#53951)
上级
69d3f4e3
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
8 addition
and
50 deletion
+8
-50
python/paddle/fluid/tests/unittests/test_expand_as_v2_op.py
python/paddle/fluid/tests/unittests/test_expand_as_v2_op.py
+3
-45
python/paddle/fluid/tests/unittests/test_meshgrid_op.py
python/paddle/fluid/tests/unittests/test_meshgrid_op.py
+5
-5
未找到文件。
python/paddle/fluid/tests/unittests/test_expand_as_v2_op.py
浏览文件 @
14e0ce71
...
...
@@ -103,10 +103,7 @@ class TestExpandAsOpRank2(TestExpandAsBasic):
or
not
core
.
is_bfloat16_supported
(
core
.
CUDAPlace
(
0
)),
"core is not compiled with CUDA or not support the bfloat16"
,
)
class
TestExpandAsOpRank2BFP16OP
(
TestExpandAsOpRank2
):
def
init_dtype
(
self
):
self
.
dtype
=
np
.
uint16
class
TestExpandAsOpRank2BFP16OP
(
TestExpandAsBasicBFP16OP
):
def
init_inputs_and_outputs
(
self
):
x
=
np
.
random
.
rand
(
10
,
12
).
astype
(
np
.
float32
)
target_tensor
=
np
.
random
.
rand
(
10
,
12
).
astype
(
np
.
float32
)
...
...
@@ -119,17 +116,6 @@ class TestExpandAsOpRank2BFP16OP(TestExpandAsOpRank2):
output
=
np
.
tile
(
x
,
bcast_dims
)
self
.
outputs
=
{
'Out'
:
convert_float_to_uint16
(
output
)}
def
if_enable_cinn
(
self
):
self
.
enable_cinn
=
False
def
test_check_output
(
self
):
self
.
check_output_with_place
(
place
=
paddle
.
CUDAPlace
(
0
))
def
test_check_grad
(
self
):
self
.
check_grad_with_place
(
paddle
.
CUDAPlace
(
0
),
[
'X'
],
'Out'
,
check_prim
=
True
)
class
TestExpandAsOpRank3
(
TestExpandAsBasic
):
def
init_inputs_and_outputs
(
self
):
...
...
@@ -147,10 +133,7 @@ class TestExpandAsOpRank3(TestExpandAsBasic):
or
not
core
.
is_bfloat16_supported
(
core
.
CUDAPlace
(
0
)),
"core is not compiled with CUDA or not support the bfloat16"
,
)
class
TestExpandAsOpRank3BFP16OP
(
TestExpandAsOpRank3
):
def
init_dtype
(
self
):
self
.
dtype
=
np
.
uint16
class
TestExpandAsOpRank3BFP16OP
(
TestExpandAsBasicBFP16OP
):
def
init_inputs_and_outputs
(
self
):
x
=
np
.
random
.
rand
(
2
,
3
,
20
).
astype
(
np
.
float32
)
target_tensor
=
np
.
random
.
rand
(
2
,
3
,
20
).
astype
(
np
.
float32
)
...
...
@@ -163,17 +146,6 @@ class TestExpandAsOpRank3BFP16OP(TestExpandAsOpRank3):
output
=
np
.
tile
(
x
,
bcast_dims
)
self
.
outputs
=
{
'Out'
:
convert_float_to_uint16
(
output
)}
def
if_enable_cinn
(
self
):
self
.
enable_cinn
=
False
def
test_check_output
(
self
):
self
.
check_output_with_place
(
place
=
paddle
.
CUDAPlace
(
0
))
def
test_check_grad
(
self
):
self
.
check_grad_with_place
(
paddle
.
CUDAPlace
(
0
),
[
'X'
],
'Out'
,
check_prim
=
True
)
class
TestExpandAsOpRank4
(
TestExpandAsBasic
):
def
init_inputs_and_outputs
(
self
):
...
...
@@ -191,10 +163,7 @@ class TestExpandAsOpRank4(TestExpandAsBasic):
or
not
core
.
is_bfloat16_supported
(
core
.
CUDAPlace
(
0
)),
"core is not compiled with CUDA or not support the bfloat16"
,
)
class
TestExpandAsOpRank4BFP16OP
(
TestExpandAsOpRank3
):
def
init_dtype
(
self
):
self
.
dtype
=
np
.
uint16
class
TestExpandAsOpRank4BFP16OP
(
TestExpandAsBasicBFP16OP
):
def
init_inputs_and_outputs
(
self
):
x
=
np
.
random
.
rand
(
1
,
1
,
7
,
16
).
astype
(
np
.
float32
)
target_tensor
=
np
.
random
.
rand
(
4
,
6
,
7
,
16
).
astype
(
np
.
float32
)
...
...
@@ -207,17 +176,6 @@ class TestExpandAsOpRank4BFP16OP(TestExpandAsOpRank3):
output
=
np
.
tile
(
x
,
bcast_dims
)
self
.
outputs
=
{
'Out'
:
convert_float_to_uint16
(
output
)}
def
if_enable_cinn
(
self
):
self
.
enable_cinn
=
False
def
test_check_output
(
self
):
self
.
check_output_with_place
(
place
=
paddle
.
CUDAPlace
(
0
))
def
test_check_grad
(
self
):
self
.
check_grad_with_place
(
paddle
.
CUDAPlace
(
0
),
[
'X'
],
'Out'
,
check_prim
=
True
)
class
TestExpandAsOpRank5
(
TestExpandAsBasic
):
no_need_check_grad
=
True
...
...
python/paddle/fluid/tests/unittests/test_meshgrid_op.py
浏览文件 @
14e0ce71
...
...
@@ -32,13 +32,13 @@ class TestMeshgridOp(OpTest):
self
.
prim_op_type
=
"comp"
self
.
python_api
=
meshgrid_wrapper
self
.
public_python_api
=
meshgrid_wrapper
self
.
dtype
=
self
.
get_d
type
()
self
.
init_data_
type
()
self
.
init_inputs_and_outputs
()
self
.
python_out_sig
=
[
'out0'
,
'out1'
]
self
.
if_enable_cinn
()
def
get_d
type
(
self
):
return
"float64"
def
init_data_
type
(
self
):
self
.
dtype
=
np
.
float64
def
test_check_output
(
self
):
self
.
check_output
(
check_prim
=
True
)
...
...
@@ -80,8 +80,8 @@ class TestMeshgridOp2Fp16(TestMeshgridOp):
def
get_x_shape
(
self
):
return
[
100
,
300
]
def
get_d
type
(
self
):
return
np
.
float16
def
init_data_
type
(
self
):
self
.
dtype
=
np
.
float16
@
unittest
.
skipIf
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录