Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
4812c707
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看板
未验证
提交
4812c707
编写于
8月 08, 2023
作者:
H
hong
提交者:
GitHub
8月 08, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[NewIR]enable dy2st new ir test in ci (#56034)
* support new ir dy2st * revert code * skip test with stride * chang import file
上级
03ca04fe
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
50 addition
and
1 deletion
+50
-1
test/dygraph_to_static/dygraph_to_static_util.py
test/dygraph_to_static/dygraph_to_static_util.py
+2
-0
test/dygraph_to_static/test_bert.py
test/dygraph_to_static/test_bert.py
+12
-1
test/dygraph_to_static/test_mobile_net.py
test/dygraph_to_static/test_mobile_net.py
+8
-0
test/dygraph_to_static/test_resnet.py
test/dygraph_to_static/test_resnet.py
+14
-0
test/dygraph_to_static/test_resnet_v2.py
test/dygraph_to_static/test_resnet_v2.py
+14
-0
未找到文件。
test/dygraph_to_static/dygraph_to_static_util.py
浏览文件 @
4812c707
...
...
@@ -121,6 +121,8 @@ def test_with_new_ir(func):
@
wraps
(
func
)
def
impl
(
*
args
,
**
kwargs
):
ir_outs
=
None
if
os
.
environ
.
get
(
'FLAGS_use_stride_kernel'
,
False
):
return
with
static
.
scope_guard
(
static
.
Scope
()):
with
static
.
program_guard
(
static
.
Program
()):
try
:
...
...
test/dygraph_to_static/test_bert.py
浏览文件 @
4812c707
...
...
@@ -20,7 +20,7 @@ import unittest
import
numpy
as
np
from
bert_dygraph_model
import
PretrainModelLayer
from
bert_utils
import
get_bert_config
,
get_feed_data_reader
from
dygraph_to_static_util
import
ast_only_test
from
dygraph_to_static_util
import
ast_only_test
,
test_with_new_ir
from
predictor_utils
import
PredictorTools
import
paddle
...
...
@@ -263,6 +263,17 @@ class TestBert(unittest.TestCase):
out
=
output
()
return
out
@
test_with_new_ir
def
test_train_new_ir
(
self
):
static_loss
,
static_ppl
=
self
.
train_static
(
self
.
bert_config
,
self
.
data_reader
)
dygraph_loss
,
dygraph_ppl
=
self
.
train_dygraph
(
self
.
bert_config
,
self
.
data_reader
)
np
.
testing
.
assert_allclose
(
static_loss
,
dygraph_loss
,
rtol
=
1e-05
)
np
.
testing
.
assert_allclose
(
static_ppl
,
dygraph_ppl
,
rtol
=
1e-05
)
@
ast_only_test
def
test_train
(
self
):
static_loss
,
static_ppl
=
self
.
train_static
(
...
...
test/dygraph_to_static/test_mobile_net.py
浏览文件 @
4812c707
...
...
@@ -19,6 +19,7 @@ import time
import
unittest
import
numpy
as
np
from
dygraph_to_static_util
import
test_with_new_ir
from
predictor_utils
import
PredictorTools
import
paddle
...
...
@@ -731,6 +732,13 @@ class TestMobileNet(unittest.TestCase):
),
)
@
test_with_new_ir
def
test_mobile_net_new_ir
(
self
):
# MobileNet-V1
self
.
assert_same_loss
(
"MobileNetV1"
)
# MobileNet-V2
self
.
assert_same_loss
(
"MobileNetV2"
)
def
test_mobile_net
(
self
):
# MobileNet-V1
self
.
assert_same_loss
(
"MobileNetV1"
)
...
...
test/dygraph_to_static/test_resnet.py
浏览文件 @
4812c707
...
...
@@ -19,6 +19,7 @@ import time
import
unittest
import
numpy
as
np
from
dygraph_to_static_util
import
test_with_new_ir
from
predictor_utils
import
PredictorTools
import
paddle
...
...
@@ -426,6 +427,19 @@ class TestResnet(unittest.TestCase):
),
)
@
test_with_new_ir
def
test_resnet_new_ir
(
self
):
static_loss
=
self
.
train
(
to_static
=
True
)
dygraph_loss
=
self
.
train
(
to_static
=
False
)
np
.
testing
.
assert_allclose
(
static_loss
,
dygraph_loss
,
rtol
=
1e-05
,
err_msg
=
'static_loss: {}
\n
dygraph_loss: {}'
.
format
(
static_loss
,
dygraph_loss
),
)
def
test_resnet
(
self
):
static_loss
=
self
.
train
(
to_static
=
True
)
dygraph_loss
=
self
.
train
(
to_static
=
False
)
...
...
test/dygraph_to_static/test_resnet_v2.py
浏览文件 @
4812c707
...
...
@@ -19,6 +19,7 @@ import time
import
unittest
import
numpy
as
np
from
dygraph_to_static_util
import
test_with_new_ir
from
predictor_utils
import
PredictorTools
import
paddle
...
...
@@ -431,6 +432,19 @@ class TestResnet(unittest.TestCase):
),
)
@
test_with_new_ir
def
test_resnet_new_ir
(
self
):
static_loss
=
self
.
train
(
to_static
=
True
)
dygraph_loss
=
self
.
train
(
to_static
=
False
)
np
.
testing
.
assert_allclose
(
static_loss
,
dygraph_loss
,
rtol
=
1e-05
,
err_msg
=
'static_loss: {}
\n
dygraph_loss: {}'
.
format
(
static_loss
,
dygraph_loss
),
)
def
test_resnet
(
self
):
static_loss
=
self
.
train
(
to_static
=
True
)
dygraph_loss
=
self
.
train
(
to_static
=
False
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录