Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
02dab46a
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看板
提交
02dab46a
编写于
1月 28, 2019
作者:
Q
Qiao Longfei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add some debug info
上级
7e145b7c
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
46 addition
and
1 deletion
+46
-1
paddle/fluid/framework/details/async_ssa_graph_executor.cc
paddle/fluid/framework/details/async_ssa_graph_executor.cc
+2
-0
paddle/fluid/framework/details/exception_holder.h
paddle/fluid/framework/details/exception_holder.h
+17
-0
paddle/fluid/operators/reader/blocking_queue.h
paddle/fluid/operators/reader/blocking_queue.h
+1
-0
python/paddle/fluid/tests/unittests/test_async_ssa_graph_executor_mnist.py
...id/tests/unittests/test_async_ssa_graph_executor_mnist.py
+26
-1
未找到文件。
paddle/fluid/framework/details/async_ssa_graph_executor.cc
浏览文件 @
02dab46a
...
...
@@ -84,6 +84,8 @@ FeedFetchList AsyncSSAGraphExecutor::Run(
}
if
(
exception_holder_
.
IsCaught
())
{
VLOG
(
3
)
<<
"caught exception "
<<
exception_holder_
.
Type
()
<<
", rethrow it"
;
exception_holder_
.
ReThrow
();
}
...
...
paddle/fluid/framework/details/exception_holder.h
浏览文件 @
02dab46a
...
...
@@ -14,6 +14,8 @@
#pragma once
#include <string>
#include "glog/logging.h"
#include "paddle/fluid/platform/enforce.h"
...
...
@@ -64,6 +66,21 @@ class ExceptionHolder {
ClearImpl
();
}
std
::
string
Type
()
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
mu_
);
switch
(
type_
)
{
case
kNone
:
return
"None"
;
case
kEnforceNotMet
:
{
return
"EnforceNotMet"
;
}
case
kEOF
:
{
return
"EOF"
;
}
}
return
"unknown"
;
}
private:
void
ClearImpl
()
{
exception_
.
reset
();
...
...
paddle/fluid/operators/reader/blocking_queue.h
浏览文件 @
02dab46a
...
...
@@ -79,6 +79,7 @@ class BlockingQueue {
return
true
;
}
else
{
PADDLE_ENFORCE
(
closed_
);
VLOG
(
3
)
<<
"queue is closed! return nothing."
;
return
false
;
}
}
...
...
python/paddle/fluid/tests/unittests/test_async_ssa_graph_executor_mnist.py
浏览文件 @
02dab46a
...
...
@@ -59,6 +59,13 @@ def train(use_cuda, thread_num, cpu_num):
img
=
fluid
.
layers
.
data
(
name
=
'img'
,
shape
=
[
1
,
28
,
28
],
dtype
=
'float32'
)
label
=
fluid
.
layers
.
data
(
name
=
'label'
,
shape
=
[
1
],
dtype
=
'int64'
)
py_reader
=
fluid
.
layers
.
create_py_reader_by_data
(
capacity
=
64
,
feed_list
=
[
img
,
label
],
name
=
'py_reader'
,
use_double_buffer
=
True
)
img
,
label
=
fluid
.
layers
.
read_file
(
py_reader
)
prediction
,
avg_loss
,
acc
=
convolutional_neural_network
(
img
,
label
)
test_program
=
fluid
.
default_main_program
().
clone
(
for_test
=
True
)
...
...
@@ -103,7 +110,7 @@ def train(use_cuda, thread_num, cpu_num):
exec_strategy
=
fluid
.
ExecutionStrategy
()
exec_strategy
.
num_threads
=
thread_num
exec_strategy
.
num_iteration_per_run
=
2
exec_strategy
.
num_iteration_per_run
=
1
main_program
=
fluid
.
default_main_program
()
pe
=
fluid
.
ParallelExecutor
(
...
...
@@ -113,6 +120,22 @@ def train(use_cuda, thread_num, cpu_num):
build_strategy
=
build_strategy
,
exec_strategy
=
exec_strategy
)
py_reader
.
decorate_paddle_reader
(
train_reader
)
py_reader
.
start
()
step
=
0
try
:
while
True
:
print
(
"step %d in"
%
step
)
loss_val
=
pe
.
run
(
fetch_list
=
[
avg_loss
.
name
])
loss_val
=
numpy
.
mean
(
loss_val
)
if
step
%
1
==
0
:
print
(
"Batch %d, Cost %f, queue size %d"
%
(
step
,
loss_val
,
py_reader
.
queue
.
size
()))
step
+=
1
except
fluid
.
core
.
EOFException
:
py_reader
.
reset
()
"""
step = 0
for step_id, data in enumerate(train_reader()):
loss_val = pe.run(feed=feeder.feed(data), fetch_list=[avg_loss.name])
...
...
@@ -120,6 +143,8 @@ def train(use_cuda, thread_num, cpu_num):
if step % 100 == 0:
print("Batch %d, Cost %f" % (step, loss_val))
step += 1
"""
# test for epoch
avg_loss_val
,
acc_val
=
train_test
(
train_test_program
=
test_program
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录