Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
418b983c
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
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看板
未验证
提交
418b983c
编写于
3月 28, 2023
作者:
Y
YuhangLi
提交者:
GitHub
3月 28, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[AMP OP&Test]shape op fp/bf16 support (#52184)
上级
ceca55c5
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
32 addition
and
3 deletion
+32
-3
python/paddle/fluid/tests/unittests/test_shape_op.py
python/paddle/fluid/tests/unittests/test_shape_op.py
+32
-3
未找到文件。
python/paddle/fluid/tests/unittests/test_shape_op.py
浏览文件 @
418b983c
...
@@ -27,13 +27,13 @@ class TestShapeOp(OpTest):
...
@@ -27,13 +27,13 @@ class TestShapeOp(OpTest):
self
.
op_type
=
"shape"
self
.
op_type
=
"shape"
self
.
python_api
=
paddle
.
shape
self
.
python_api
=
paddle
.
shape
self
.
config
()
self
.
config
()
self
.
shape
=
[
2
,
3
]
input
=
np
.
zeros
(
self
.
shape
,
dtype
=
self
.
dtype
)
input
=
np
.
zeros
(
self
.
shape
)
self
.
inputs
=
{
'Input'
:
input
}
self
.
inputs
=
{
'Input'
:
input
}
self
.
outputs
=
{
'Out'
:
np
.
array
(
self
.
shape
)}
self
.
outputs
=
{
'Out'
:
np
.
array
(
self
.
shape
)}
def
config
(
self
):
def
config
(
self
):
self
.
shape
=
[
2
,
3
]
self
.
shape
=
[
2
,
3
]
self
.
dtype
=
np
.
float32
def
test_check_output
(
self
):
def
test_check_output
(
self
):
self
.
check_output
()
self
.
check_output
()
...
@@ -42,11 +42,31 @@ class TestShapeOp(OpTest):
...
@@ -42,11 +42,31 @@ class TestShapeOp(OpTest):
class
case1
(
TestShapeOp
):
class
case1
(
TestShapeOp
):
def
config
(
self
):
def
config
(
self
):
self
.
shape
=
[
2
]
self
.
shape
=
[
2
]
self
.
dtype
=
np
.
float32
class
case2
(
TestShapeOp
):
class
case2
(
TestShapeOp
):
def
config
(
self
):
def
config
(
self
):
self
.
shape
=
[
1
,
2
,
3
]
self
.
shape
=
[
1
,
2
,
3
]
self
.
dtype
=
np
.
float32
class
TestShapeOpFp16
(
TestShapeOp
):
def
config
(
self
):
self
.
shape
=
[
2
,
3
]
self
.
dtype
=
np
.
float16
class
case1Fp16
(
TestShapeOp
):
def
config
(
self
):
self
.
shape
=
[
2
]
self
.
dtype
=
np
.
float16
class
case2Fp16
(
TestShapeOp
):
def
config
(
self
):
self
.
shape
=
[
1
,
2
,
3
]
self
.
dtype
=
np
.
float16
class
TestShapeWithSelectedRows
(
unittest
.
TestCase
):
class
TestShapeWithSelectedRows
(
unittest
.
TestCase
):
...
@@ -95,7 +115,6 @@ class TestShapeOpBf16(OpTest):
...
@@ -95,7 +115,6 @@ class TestShapeOpBf16(OpTest):
self
.
dtype
=
'bfloat16'
self
.
dtype
=
'bfloat16'
self
.
python_api
=
paddle
.
shape
self
.
python_api
=
paddle
.
shape
self
.
config
()
self
.
config
()
self
.
shape
=
[
2
,
3
]
input
=
np
.
zeros
(
self
.
shape
)
input
=
np
.
zeros
(
self
.
shape
)
input
=
convert_float_to_uint16
(
input
.
astype
(
'float32'
))
input
=
convert_float_to_uint16
(
input
.
astype
(
'float32'
))
self
.
inputs
=
{
'Input'
:
input
}
self
.
inputs
=
{
'Input'
:
input
}
...
@@ -109,5 +128,15 @@ class TestShapeOpBf16(OpTest):
...
@@ -109,5 +128,15 @@ class TestShapeOpBf16(OpTest):
self
.
check_output_with_place
(
place
)
self
.
check_output_with_place
(
place
)
class
case1Bf16
(
TestShapeOpBf16
):
def
config
(
self
):
self
.
shape
=
[
2
]
class
case2Bf16
(
TestShapeOpBf16
):
def
config
(
self
):
self
.
shape
=
[
1
,
2
,
3
]
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
unittest
.
main
()
unittest
.
main
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录