Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
0a7ae369
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看板
提交
0a7ae369
编写于
2月 09, 2018
作者:
T
typhoonzero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix CI hung
上级
36da5295
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
13 addition
and
0 deletion
+13
-0
python/paddle/v2/fluid/tests/book_memory_optimization/test_memopt_fit_a_line.py
.../tests/book_memory_optimization/test_memopt_fit_a_line.py
+4
-0
python/paddle/v2/fluid/tests/book_memory_optimization/test_memopt_image_classification_train.py
...ry_optimization/test_memopt_image_classification_train.py
+5
-0
python/paddle/v2/fluid/tests/book_memory_optimization/test_memopt_machine_translation.py
...ok_memory_optimization/test_memopt_machine_translation.py
+4
-0
未找到文件。
python/paddle/v2/fluid/tests/book_memory_optimization/test_memopt_fit_a_line.py
浏览文件 @
0a7ae369
...
@@ -15,6 +15,8 @@
...
@@ -15,6 +15,8 @@
import
numpy
as
np
import
numpy
as
np
import
paddle.v2
as
paddle
import
paddle.v2
as
paddle
import
paddle.v2.fluid
as
fluid
import
paddle.v2.fluid
as
fluid
import
math
import
sys
# need to fix random seed and training data to compare the loss
# need to fix random seed and training data to compare the loss
# value accurately calculated by the default and the memory optimization
# value accurately calculated by the default and the memory optimization
...
@@ -63,4 +65,6 @@ for pass_id in range(PASS_NUM):
...
@@ -63,4 +65,6 @@ for pass_id in range(PASS_NUM):
if
avg_loss_value
[
0
]
<
10.0
:
if
avg_loss_value
[
0
]
<
10.0
:
exit
(
0
)
# if avg cost less than 10.0, we think our code is good.
exit
(
0
)
# if avg cost less than 10.0, we think our code is good.
if
math
.
isnan
(
float
(
avg_loss_value
)):
sys
.
exit
(
"got NaN loss, training failed."
)
exit
(
1
)
exit
(
1
)
python/paddle/v2/fluid/tests/book_memory_optimization/test_memopt_image_classification_train.py
浏览文件 @
0a7ae369
...
@@ -18,6 +18,8 @@ import sys
...
@@ -18,6 +18,8 @@ import sys
import
paddle.v2
as
paddle
import
paddle.v2
as
paddle
import
paddle.v2.fluid
as
fluid
import
paddle.v2.fluid
as
fluid
import
math
import
sys
# need to fix random seed and training data to compare the loss
# need to fix random seed and training data to compare the loss
# value accurately calculated by the default and the memory optimization
# value accurately calculated by the default and the memory optimization
...
@@ -152,7 +154,10 @@ for pass_id in range(PASS_NUM):
...
@@ -152,7 +154,10 @@ for pass_id in range(PASS_NUM):
print
(
"loss:"
+
str
(
loss
)
+
" acc:"
+
str
(
acc
)
+
" pass_acc:"
+
str
(
print
(
"loss:"
+
str
(
loss
)
+
" acc:"
+
str
(
acc
)
+
" pass_acc:"
+
str
(
pass_acc
))
pass_acc
))
# this model is slow, so if we can train two mini batch, we think it works properly.
# this model is slow, so if we can train two mini batch, we think it works properly.
if
i
>
2
:
if
i
>
2
:
exit
(
0
)
exit
(
0
)
if
math
.
isnan
(
float
(
loss
)):
sys
.
exit
(
"got NaN loss, training failed."
)
i
+=
1
i
+=
1
exit
(
1
)
exit
(
1
)
python/paddle/v2/fluid/tests/book_memory_optimization/test_memopt_machine_translation.py
浏览文件 @
0a7ae369
...
@@ -19,6 +19,8 @@ import paddle.v2.fluid.core as core
...
@@ -19,6 +19,8 @@ import paddle.v2.fluid.core as core
import
paddle.v2.fluid.framework
as
framework
import
paddle.v2.fluid.framework
as
framework
import
paddle.v2.fluid.layers
as
layers
import
paddle.v2.fluid.layers
as
layers
from
paddle.v2.fluid.executor
import
Executor
from
paddle.v2.fluid.executor
import
Executor
import
math
import
sys
dict_size
=
30000
dict_size
=
30000
source_dict_dim
=
target_dict_dim
=
dict_size
source_dict_dim
=
target_dict_dim
=
dict_size
...
@@ -137,6 +139,8 @@ def main():
...
@@ -137,6 +139,8 @@ def main():
" avg_cost="
+
str
(
avg_cost_val
))
" avg_cost="
+
str
(
avg_cost_val
))
if
batch_id
>
2
:
if
batch_id
>
2
:
exit
(
0
)
exit
(
0
)
if
math
.
isnan
(
float
(
avg_cost_val
)):
sys
.
exit
(
"got NaN loss, training failed."
)
batch_id
+=
1
batch_id
+=
1
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录