Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
cc7b4b9e
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2302
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看板
未验证
提交
cc7b4b9e
编写于
5月 23, 2018
作者:
D
daminglu
提交者:
GitHub
5月 23, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add return_numpy back (#10892)
上级
8653cf30
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
9 addition
and
7 deletion
+9
-7
python/paddle/fluid/inferencer.py
python/paddle/fluid/inferencer.py
+6
-4
python/paddle/fluid/tests/book/high-level-api/fit_a_line/test_fit_a_line.py
...d/tests/book/high-level-api/fit_a_line/test_fit_a_line.py
+1
-1
python/paddle/fluid/tests/book/high-level-api/recognize_digits/test_recognize_digits_conv.py
...-level-api/recognize_digits/test_recognize_digits_conv.py
+1
-1
python/paddle/fluid/tests/book/high-level-api/recognize_digits/test_recognize_digits_mlp.py
...h-level-api/recognize_digits/test_recognize_digits_mlp.py
+1
-1
未找到文件。
python/paddle/fluid/inferencer.py
浏览文件 @
cc7b4b9e
...
...
@@ -56,7 +56,7 @@ class Inferencer(object):
else
:
self
.
exe
=
executor
.
Executor
(
self
.
place
)
def
infer
(
self
,
inputs
):
def
infer
(
self
,
inputs
,
return_numpy
=
True
):
"""
:param inputs: a map of {"input_name": input_var} that will be feed into the inference program
to get the predict value
...
...
@@ -66,9 +66,11 @@ class Inferencer(object):
raise
ValueError
(
"inputs should be a map of {'input_name': input_var}"
)
with
self
.
_prog_and_scope_guard
():
results
=
self
.
exe
.
run
(
feed
=
inputs
,
fetch_list
=
[
self
.
predict_var
.
name
])
with
executor
.
scope_guard
(
self
.
scope
):
results
=
self
.
exe
.
run
(
self
.
inference_program
,
feed
=
inputs
,
fetch_list
=
[
self
.
predict_var
],
return_numpy
=
return_numpy
)
return
results
...
...
python/paddle/fluid/tests/book/high-level-api/fit_a_line/test_fit_a_line.py
浏览文件 @
cc7b4b9e
...
...
@@ -92,7 +92,7 @@ def infer(use_cuda, inference_program, save_dirname=None):
tensor_x
=
numpy
.
random
.
uniform
(
0
,
10
,
[
batch_size
,
13
]).
astype
(
"float32"
)
results
=
inferencer
.
infer
({
'x'
:
tensor_x
})
print
(
"infer results: "
,
numpy
.
array
(
results
[
0
])
)
print
(
"infer results: "
,
results
[
0
]
)
def
main
(
use_cuda
):
...
...
python/paddle/fluid/tests/book/high-level-api/recognize_digits/test_recognize_digits_conv.py
浏览文件 @
cc7b4b9e
...
...
@@ -112,7 +112,7 @@ def infer(use_cuda, inference_program, save_dirname=None):
results
=
inferencer
.
infer
({
'img'
:
tensor_img
})
print
(
"infer results: "
,
numpy
.
array
(
results
[
0
])
)
print
(
"infer results: "
,
results
[
0
]
)
def
main
(
use_cuda
):
...
...
python/paddle/fluid/tests/book/high-level-api/recognize_digits/test_recognize_digits_mlp.py
浏览文件 @
cc7b4b9e
...
...
@@ -93,7 +93,7 @@ def infer(use_cuda, inference_program, save_dirname=None):
results
=
inferencer
.
infer
({
'img'
:
tensor_img
})
print
(
"infer results: "
,
numpy
.
array
(
results
[
0
])
)
print
(
"infer results: "
,
results
[
0
]
)
def
main
(
use_cuda
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录