Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wmsofts
Paddle
提交
e397a3ff
P
Paddle
项目概览
wmsofts
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
0
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
e397a3ff
编写于
3月 09, 2023
作者:
Z
Zhang Zheng
提交者:
GitHub
3月 09, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[AMP_OP&Test] Add float16 OpTest for full_op (#50723)
上级
aab713ea
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
45 addition
and
34 deletion
+45
-34
python/paddle/fluid/tests/unittests/test_fill_constant_op.py
python/paddle/fluid/tests/unittests/test_fill_constant_op.py
+45
-34
未找到文件。
python/paddle/fluid/tests/unittests/test_fill_constant_op.py
浏览文件 @
e397a3ff
...
...
@@ -30,60 +30,71 @@ def fill_wrapper(shape, value=0.0):
# Situation 1: Attr(shape) is a list(without tensor)
class
TestFillConstantOp1
(
OpTest
):
# Base case
class
TestFillConstantOp
(
OpTest
):
def
setUp
(
self
):
'''Test fill_constant op with
specified
value'''
'''Test fill_constant op with
default
value'''
self
.
op_type
=
"fill_constant"
self
.
python_api
=
fill_wrapper
self
.
init_dtype
()
self
.
init_shape
()
self
.
init_value
()
self
.
inputs
=
{}
self
.
attrs
=
{
'shape'
:
[
123
,
92
],
'value'
:
3.8
}
self
.
outputs
=
{
'Out'
:
np
.
full
(
(
123
,
92
),
3.8
)}
self
.
attrs
=
{
'shape'
:
self
.
shape
,
'value'
:
self
.
value
}
self
.
outputs
=
{
'Out'
:
np
.
full
(
self
.
shape
,
self
.
value
)}
def
test_check_output
(
self
):
self
.
check_output
()
def
init_dtype
(
self
):
self
.
dtype
=
np
.
float64
class
TestFillConstantOp2
(
OpTest
):
def
setUp
(
self
):
'''Test fill_constant op with default value'''
self
.
op_type
=
"fill_constant"
self
.
python_api
=
fill_wrapper
def
init_shape
(
self
):
self
.
shape
=
[
123
,
92
]
self
.
inputs
=
{}
self
.
attrs
=
{
'shape'
:
[
123
,
92
]}
self
.
outputs
=
{
'Out'
:
np
.
full
((
123
,
92
),
0.0
)}
def
init_value
(
self
):
self
.
value
=
0.0
def
test_check_output
(
self
):
self
.
check_output
()
class
TestFillConstantFP32Op
(
TestFillConstantOp
):
'''Test fill_constant op with specified value'''
class
TestFillConstantOp3
(
OpTest
):
def
setUp
(
self
):
'''Test fill_constant op with specified int64 value'''
self
.
op_type
=
"fill_constant"
self
.
python_api
=
fill_wrapper
def
init_dtype
(
self
):
self
.
dtype
=
np
.
float32
self
.
inputs
=
{}
self
.
attrs
=
{
'shape'
:
[
123
,
92
],
'value'
:
10000000000
}
self
.
outputs
=
{
'Out'
:
np
.
full
((
123
,
92
),
10000000000
)}
def
init_value
(
self
):
self
.
value
=
3.8
def
test_check_output
(
self
):
self
.
check_output
()
class
TestFillConstantFP16Op
(
TestFillConstantOp
):
'''Test fill_constant op with specified value'''
class
TestFillConstantOp4
(
OpTest
):
def
setUp
(
self
):
'''Test fill_constant op with specified int value'''
self
.
op_type
=
"fill_constant"
self
.
python_api
=
fill_wrapper
def
init_dtype
(
self
):
self
.
dtype
=
np
.
float16
self
.
inputs
=
{}
self
.
attrs
=
{
'shape'
:
[
123
,
92
],
'value'
:
3
}
self
.
outputs
=
{
'Out'
:
np
.
full
((
123
,
92
),
3
)}
def
init_value
(
self
):
self
.
value
=
3.8
def
test_check_output
(
self
):
self
.
check_output
()
class
TestFillConstantINT64Op
(
TestFillConstantOp
):
'''Test fill_constant op with specified int64 value'''
def
init_dtype
(
self
):
self
.
dtype
=
np
.
int64
def
init_value
(
self
):
self
.
value
=
10000000000
class
TestFillConstantINT32Op
(
TestFillConstantOp
):
'''Test fill_constant op with specified int value'''
def
init_dtype
(
self
):
self
.
dtype
=
np
.
int32
def
init_value
(
self
):
self
.
value
=
3
@
unittest
.
skipIf
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录