Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
5a6c974e
P
Paddle
项目概览
Crayon鑫
/
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看板
未验证
提交
5a6c974e
编写于
6月 08, 2022
作者:
Q
Qi Li
提交者:
GitHub
6月 08, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix unit test temp file, test=develop (#43155)
上级
9c17688a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
11 addition
and
3 deletion
+11
-3
python/paddle/fluid/tests/unittests/ipu/test_weight_decay_ipu.py
...paddle/fluid/tests/unittests/ipu/test_weight_decay_ipu.py
+5
-1
python/paddle/fluid/tests/unittests/test_load_op_xpu.py
python/paddle/fluid/tests/unittests/test_load_op_xpu.py
+6
-2
未找到文件。
python/paddle/fluid/tests/unittests/ipu/test_weight_decay_ipu.py
浏览文件 @
5a6c974e
...
@@ -14,7 +14,9 @@
...
@@ -14,7 +14,9 @@
import
unittest
import
unittest
import
os
import
numpy
as
np
import
numpy
as
np
import
tempfile
import
paddle
import
paddle
import
paddle.static
import
paddle.static
from
paddle.fluid.tests.unittests.ipu.op_test_ipu
import
IPUOpTest
from
paddle.fluid.tests.unittests.ipu.op_test_ipu
import
IPUOpTest
...
@@ -30,6 +32,8 @@ class TestBase(IPUOpTest):
...
@@ -30,6 +32,8 @@ class TestBase(IPUOpTest):
self
.
set_data_feed
()
self
.
set_data_feed
()
self
.
set_feed_attr
()
self
.
set_feed_attr
()
self
.
set_attrs
()
self
.
set_attrs
()
self
.
temp_dir
=
tempfile
.
TemporaryDirectory
()
self
.
model_path
=
os
.
path
.
join
(
self
.
temp_dir
.
name
,
"weight_decay"
)
def
set_atol
(
self
):
def
set_atol
(
self
):
self
.
atol
=
1e-6
self
.
atol
=
1e-6
...
@@ -88,7 +92,7 @@ class TestBase(IPUOpTest):
...
@@ -88,7 +92,7 @@ class TestBase(IPUOpTest):
place
=
paddle
.
CPUPlace
()
place
=
paddle
.
CPUPlace
()
exe
=
paddle
.
static
.
Executor
(
place
)
exe
=
paddle
.
static
.
Executor
(
place
)
exe
.
run
(
startup_prog
)
exe
.
run
(
startup_prog
)
paddle
.
static
.
save
(
main_prog
,
"weight_decay"
)
paddle
.
static
.
save
(
main_prog
,
self
.
model_path
)
if
run_ipu
:
if
run_ipu
:
feed_list
=
[
image
.
name
]
feed_list
=
[
image
.
name
]
...
...
python/paddle/fluid/tests/unittests/test_load_op_xpu.py
浏览文件 @
5a6c974e
...
@@ -16,6 +16,8 @@ from __future__ import print_function
...
@@ -16,6 +16,8 @@ from __future__ import print_function
import
unittest
import
unittest
import
numpy
as
np
import
numpy
as
np
import
os
import
tempfile
from
op_test
import
OpTest
,
randomize_probability
from
op_test
import
OpTest
,
randomize_probability
import
paddle.fluid
as
fluid
import
paddle.fluid
as
fluid
import
paddle.fluid.layers
as
layers
import
paddle.fluid.layers
as
layers
...
@@ -29,6 +31,8 @@ class TestLoadOpXpu(unittest.TestCase):
...
@@ -29,6 +31,8 @@ class TestLoadOpXpu(unittest.TestCase):
"""
"""
def
setUp
(
self
):
def
setUp
(
self
):
self
.
temp_dir
=
tempfile
.
TemporaryDirectory
()
self
.
model_path
=
os
.
path
.
join
(
self
.
temp_dir
.
name
,
"model"
)
self
.
ones
=
np
.
ones
((
4
,
4
)).
astype
(
'float32'
)
self
.
ones
=
np
.
ones
((
4
,
4
)).
astype
(
'float32'
)
main_prog
=
fluid
.
Program
()
main_prog
=
fluid
.
Program
()
start_prog
=
fluid
.
Program
()
start_prog
=
fluid
.
Program
()
...
@@ -44,7 +48,7 @@ class TestLoadOpXpu(unittest.TestCase):
...
@@ -44,7 +48,7 @@ class TestLoadOpXpu(unittest.TestCase):
exe
=
fluid
.
Executor
(
fluid
.
XPUPlace
(
0
))
exe
=
fluid
.
Executor
(
fluid
.
XPUPlace
(
0
))
exe
.
run
(
start_prog
)
exe
.
run
(
start_prog
)
fluid
.
io
.
save_persistables
(
exe
,
fluid
.
io
.
save_persistables
(
exe
,
dirname
=
"./model"
,
dirname
=
self
.
model_path
,
main_program
=
main_prog
)
main_program
=
main_prog
)
def
test_load_xpu
(
self
):
def
test_load_xpu
(
self
):
...
@@ -52,7 +56,7 @@ class TestLoadOpXpu(unittest.TestCase):
...
@@ -52,7 +56,7 @@ class TestLoadOpXpu(unittest.TestCase):
start_prog
=
fluid
.
Program
()
start_prog
=
fluid
.
Program
()
with
fluid
.
program_guard
(
main_prog
,
start_prog
):
with
fluid
.
program_guard
(
main_prog
,
start_prog
):
var
=
layers
.
create_tensor
(
dtype
=
'float32'
)
var
=
layers
.
create_tensor
(
dtype
=
'float32'
)
layers
.
load
(
var
,
file_path
=
'./model
/w'
)
layers
.
load
(
var
,
file_path
=
self
.
model_path
+
'
/w'
)
exe
=
fluid
.
Executor
(
fluid
.
XPUPlace
(
0
))
exe
=
fluid
.
Executor
(
fluid
.
XPUPlace
(
0
))
exe
.
run
(
start_prog
)
exe
.
run
(
start_prog
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录