Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
book
提交
6bed4dab
B
book
项目概览
PaddlePaddle
/
book
通知
16
Star
4
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
40
列表
看板
标记
里程碑
合并请求
37
Wiki
5
Wiki
分析
仓库
DevOps
项目成员
Pages
B
book
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
40
Issue
40
列表
看板
标记
里程碑
合并请求
37
合并请求
37
Pages
分析
分析
仓库分析
DevOps
Wiki
5
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
6bed4dab
编写于
8月 27, 2019
作者:
S
silingtong123
提交者:
Tao Luo
8月 27, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove the usage of InferenceTranspiler (#797)
上级
361b25db
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
4 addition
and
66 deletion
+4
-66
03.image_classification/README.cn.md
03.image_classification/README.cn.md
+1
-13
03.image_classification/README.md
03.image_classification/README.md
+1
-12
03.image_classification/index.cn.html
03.image_classification/index.cn.html
+1
-13
03.image_classification/index.html
03.image_classification/index.html
+1
-12
03.image_classification/train.py
03.image_classification/train.py
+0
-16
未找到文件。
03.image_classification/README.cn.md
浏览文件 @
6bed4dab
...
@@ -538,11 +538,7 @@ with fluid.scope_guard(inference_scope):
...
@@ -538,11 +538,7 @@ with fluid.scope_guard(inference_scope):
[
inference_program
,
feed_target_names
,
[
inference_program
,
feed_target_names
,
fetch_targets
]
=
fluid
.
io
.
load_inference_model
(
params_dirname
,
exe
)
fetch_targets
]
=
fluid
.
io
.
load_inference_model
(
params_dirname
,
exe
)
# The input's dimension of conv should be 4-D or 5-D.
# Use inference_transpiler to speedup
inference_transpiler_program
=
inference_program
.
clone
()
t
=
fluid
.
transpiler
.
InferenceTranspiler
()
t
.
transpile
(
inference_transpiler_program
,
place
)
# Construct feed as a dictionary of {feed_target_name: feed_target_data}
# Construct feed as a dictionary of {feed_target_name: feed_target_data}
# and results will contain a list of data corresponding to fetch_targets.
# and results will contain a list of data corresponding to fetch_targets.
...
@@ -550,14 +546,6 @@ with fluid.scope_guard(inference_scope):
...
@@ -550,14 +546,6 @@ with fluid.scope_guard(inference_scope):
feed
=
{
feed_target_names
[
0
]:
img
},
feed
=
{
feed_target_names
[
0
]:
img
},
fetch_list
=
fetch_targets
)
fetch_list
=
fetch_targets
)
transpiler_results
=
exe
.
run
(
inference_transpiler_program
,
feed
=
{
feed_target_names
[
0
]:
img
},
fetch_list
=
fetch_targets
)
assert
len
(
results
[
0
])
==
len
(
transpiler_results
[
0
])
for
i
in
range
(
len
(
results
[
0
])):
numpy
.
testing
.
assert_almost_equal
(
results
[
0
][
i
],
transpiler_results
[
0
][
i
],
decimal
=
5
)
# infer label
# infer label
label_list
=
[
label_list
=
[
...
...
03.image_classification/README.md
浏览文件 @
6bed4dab
...
@@ -541,11 +541,7 @@ with fluid.scope_guard(inference_scope):
...
@@ -541,11 +541,7 @@ with fluid.scope_guard(inference_scope):
[
inference_program
,
feed_target_names
,
[
inference_program
,
feed_target_names
,
fetch_targets
]
=
fluid
.
io
.
load_inference_model
(
params_dirname
,
exe
)
fetch_targets
]
=
fluid
.
io
.
load_inference_model
(
params_dirname
,
exe
)
# The input's dimension of conv should be 4-D or 5-D.
# Use inference_transpiler to speedup
inference_transpiler_program
=
inference_program
.
clone
()
t
=
fluid
.
transpiler
.
InferenceTranspiler
()
t
.
transpile
(
inference_transpiler_program
,
place
)
# Construct feed as a dictionary of {feed_target_name: feed_target_data}
# Construct feed as a dictionary of {feed_target_name: feed_target_data}
# and results will contain a list of data corresponding to fetch_targets.
# and results will contain a list of data corresponding to fetch_targets.
...
@@ -553,14 +549,7 @@ with fluid.scope_guard(inference_scope):
...
@@ -553,14 +549,7 @@ with fluid.scope_guard(inference_scope):
feed
=
{
feed_target_names
[
0
]:
img
},
feed
=
{
feed_target_names
[
0
]:
img
},
fetch_list
=
fetch_targets
)
fetch_list
=
fetch_targets
)
transpiler_results
=
exe
.
run
(
inference_transpiler_program
,
feed
=
{
feed_target_names
[
0
]:
img
},
fetch_list
=
fetch_targets
)
assert
len
(
results
[
0
])
==
len
(
transpiler_results
[
0
])
for
i
in
range
(
len
(
results
[
0
])):
numpy
.
testing
.
assert_almost_equal
(
results
[
0
][
i
],
transpiler_results
[
0
][
i
],
decimal
=
5
)
# infer label
# infer label
label_list
=
[
label_list
=
[
...
...
03.image_classification/index.cn.html
浏览文件 @
6bed4dab
...
@@ -580,11 +580,7 @@ with fluid.scope_guard(inference_scope):
...
@@ -580,11 +580,7 @@ with fluid.scope_guard(inference_scope):
[inference_program, feed_target_names,
[inference_program, feed_target_names,
fetch_targets] = fluid.io.load_inference_model(params_dirname, exe)
fetch_targets] = fluid.io.load_inference_model(params_dirname, exe)
# The input's dimension of conv should be 4-D or 5-D.
# Use inference_transpiler to speedup
inference_transpiler_program = inference_program.clone()
t = fluid.transpiler.InferenceTranspiler()
t.transpile(inference_transpiler_program, place)
# Construct feed as a dictionary of {feed_target_name: feed_target_data}
# Construct feed as a dictionary of {feed_target_name: feed_target_data}
# and results will contain a list of data corresponding to fetch_targets.
# and results will contain a list of data corresponding to fetch_targets.
...
@@ -592,14 +588,6 @@ with fluid.scope_guard(inference_scope):
...
@@ -592,14 +588,6 @@ with fluid.scope_guard(inference_scope):
feed={feed_target_names[0]: img},
feed={feed_target_names[0]: img},
fetch_list=fetch_targets)
fetch_list=fetch_targets)
transpiler_results = exe.run(inference_transpiler_program,
feed={feed_target_names[0]: img},
fetch_list=fetch_targets)
assert len(results[0]) == len(transpiler_results[0])
for i in range(len(results[0])):
numpy.testing.assert_almost_equal(
results[0][i], transpiler_results[0][i], decimal=5)
# infer label
# infer label
label_list = [
label_list = [
...
...
03.image_classification/index.html
浏览文件 @
6bed4dab
...
@@ -583,11 +583,7 @@ with fluid.scope_guard(inference_scope):
...
@@ -583,11 +583,7 @@ with fluid.scope_guard(inference_scope):
[inference_program, feed_target_names,
[inference_program, feed_target_names,
fetch_targets] = fluid.io.load_inference_model(params_dirname, exe)
fetch_targets] = fluid.io.load_inference_model(params_dirname, exe)
# The input's dimension of conv should be 4-D or 5-D.
# Use inference_transpiler to speedup
inference_transpiler_program = inference_program.clone()
t = fluid.transpiler.InferenceTranspiler()
t.transpile(inference_transpiler_program, place)
# Construct feed as a dictionary of {feed_target_name: feed_target_data}
# Construct feed as a dictionary of {feed_target_name: feed_target_data}
# and results will contain a list of data corresponding to fetch_targets.
# and results will contain a list of data corresponding to fetch_targets.
...
@@ -595,14 +591,7 @@ with fluid.scope_guard(inference_scope):
...
@@ -595,14 +591,7 @@ with fluid.scope_guard(inference_scope):
feed={feed_target_names[0]: img},
feed={feed_target_names[0]: img},
fetch_list=fetch_targets)
fetch_list=fetch_targets)
transpiler_results = exe.run(inference_transpiler_program,
feed={feed_target_names[0]: img},
fetch_list=fetch_targets)
assert len(results[0]) == len(transpiler_results[0])
for i in range(len(results[0])):
numpy.testing.assert_almost_equal(
results[0][i], transpiler_results[0][i], decimal=5)
# infer label
# infer label
label_list = [
label_list = [
...
...
03.image_classification/train.py
浏览文件 @
6bed4dab
...
@@ -191,12 +191,6 @@ def infer(use_cuda, params_dirname=None):
...
@@ -191,12 +191,6 @@ def infer(use_cuda, params_dirname=None):
[
inference_program
,
feed_target_names
,
[
inference_program
,
feed_target_names
,
fetch_targets
]
=
fluid
.
io
.
load_inference_model
(
params_dirname
,
exe
)
fetch_targets
]
=
fluid
.
io
.
load_inference_model
(
params_dirname
,
exe
)
# The input's dimension of conv should be 4-D or 5-D.
# Use inference_transpiler to speedup
inference_transpiler_program
=
inference_program
.
clone
()
t
=
fluid
.
transpiler
.
InferenceTranspiler
()
t
.
transpile
(
inference_transpiler_program
,
place
)
# Construct feed as a dictionary of {feed_target_name: feed_target_data}
# Construct feed as a dictionary of {feed_target_name: feed_target_data}
# and results will contain a list of data corresponding to fetch_targets.
# and results will contain a list of data corresponding to fetch_targets.
results
=
exe
.
run
(
results
=
exe
.
run
(
...
@@ -204,16 +198,6 @@ def infer(use_cuda, params_dirname=None):
...
@@ -204,16 +198,6 @@ def infer(use_cuda, params_dirname=None):
feed
=
{
feed_target_names
[
0
]:
img
},
feed
=
{
feed_target_names
[
0
]:
img
},
fetch_list
=
fetch_targets
)
fetch_list
=
fetch_targets
)
transpiler_results
=
exe
.
run
(
inference_transpiler_program
,
feed
=
{
feed_target_names
[
0
]:
img
},
fetch_list
=
fetch_targets
)
assert
len
(
results
[
0
])
==
len
(
transpiler_results
[
0
])
for
i
in
range
(
len
(
results
[
0
])):
numpy
.
testing
.
assert_almost_equal
(
results
[
0
][
i
],
transpiler_results
[
0
][
i
],
decimal
=
5
)
# infer label
# infer label
label_list
=
[
label_list
=
[
"airplane"
,
"automobile"
,
"bird"
,
"cat"
,
"deer"
,
"dog"
,
"frog"
,
"airplane"
,
"automobile"
,
"bird"
,
"cat"
,
"deer"
,
"dog"
,
"frog"
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录