Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
54a78cc1
S
Serving
项目概览
PaddlePaddle
/
Serving
大约 1 年 前同步成功
通知
186
Star
833
Fork
253
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
105
列表
看板
标记
里程碑
合并请求
10
Wiki
2
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Serving
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
105
Issue
105
列表
看板
标记
里程碑
合并请求
10
合并请求
10
Pages
分析
分析
仓库分析
DevOps
Wiki
2
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
54a78cc1
编写于
11月 08, 2021
作者:
J
Jiawei Wang
提交者:
GitHub
11月 08, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1472 from TeslaZhao/develop
python pipeline support lod input
上级
0376fd4c
433ff7f9
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
26 addition
and
3 deletion
+26
-3
python/pipeline/operator.py
python/pipeline/operator.py
+13
-3
python/pipeline/pipeline_client.py
python/pipeline/pipeline_client.py
+13
-0
未找到文件。
python/pipeline/operator.py
浏览文件 @
54a78cc1
...
...
@@ -1589,13 +1589,15 @@ class RequestOp(Op):
tensor: one tensor in request.tensors.
Returns:
np.ndnumpy
np_data: np.ndnumpy, the tensor data is converted to numpy.
lod_info: np.ndnumpy, lod info of the tensor data, None default.
"""
if
tensor
is
None
or
tensor
.
elem_type
is
None
or
tensor
.
name
is
None
:
_LOGGER
.
error
(
"input params of tensor is wrong. tensor: {}"
.
format
(
tensor
))
return
None
# Set dim shape
dims
=
[]
if
tensor
.
shape
is
None
:
dims
.
append
(
1
)
...
...
@@ -1603,6 +1605,11 @@ class RequestOp(Op):
for
one_dim
in
tensor
.
shape
:
dims
.
append
(
one_dim
)
# Set up 2-d lod tensor
np_lod
=
None
if
len
(
tensor
.
lod
)
>
0
:
np_lod
=
np
.
array
(
tensor
.
lod
).
astype
(
int32
).
reshape
(
2
,
-
1
)
np_data
=
None
_LOGGER
.
info
(
"proto_to_numpy, name:{}, type:{}, dims:{}"
.
format
(
tensor
.
name
,
tensor
.
elem_type
,
dims
))
...
...
@@ -1648,7 +1655,7 @@ class RequestOp(Op):
"Sorry, the type {} of tensor {} is not supported."
.
format
(
tensor
.
elem_type
,
tensor
.
name
))
return
np_data
return
np_data
,
np_lod
def
unpack_request_package
(
self
,
request
):
"""
...
...
@@ -1705,7 +1712,10 @@ class RequestOp(Op):
dict_data
[
name
]
=
new_string
else
:
dict_data
[
name
]
=
self
.
proto_tensor_2_numpy
(
one_tensor
)
np_data
,
np_lod
=
self
.
proto_tensor_2_numpy
(
one_tensor
)
dict_data
[
name
]
=
np_data
if
np_lod
is
not
None
:
dict_data
[
name
+
".lod"
]
=
np_lod
_LOGGER
.
info
(
"RequestOp unpack one request. log_id:{}, clientip:{}
\
name:{}, method:{}, time:{}"
...
...
python/pipeline/pipeline_client.py
浏览文件 @
54a78cc1
...
...
@@ -98,6 +98,12 @@ class PipelineClient(object):
else
:
# pack tensor format
for
key
,
value
in
feed_dict
.
items
():
# skipping the lod feed_var.
# The declare of lod feed_var must be hebind the feed_var.
if
".lod"
in
key
:
continue
one_tensor
=
req
.
tensors
.
add
()
one_tensor
.
name
=
key
...
...
@@ -114,6 +120,13 @@ class PipelineClient(object):
for
one_dim
in
value
.
shape
:
one_tensor
.
shape
.
append
(
one_dim
)
# set lod info, must be list type.
lod_key
=
key
+
".lod"
if
lod_key
in
feed_dict
:
lod_list
=
feed_dict
.
get
(
lod_key
)
if
lod_list
is
not
None
:
one_tensor
.
lod
.
extend
(
lod_list
)
# packed into bytes
if
use_tensor_bytes
is
True
:
np_bytes
=
BytesIO
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录