Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
9ab4f123
M
mindspore
项目概览
magicwindyyd
/
mindspore
与 Fork 源项目一致
Fork自
MindSpore / mindspore
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindspore
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
9ab4f123
编写于
8月 26, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
8月 26, 2020
浏览文件
操作
浏览文件
下载
差异文件
!5041 fix shape
Merge pull request !5041 from hexia/shape_wrong
上级
9e8c4f37
4f25e7b1
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
9 addition
and
6 deletion
+9
-6
serving/CMakeLists.txt
serving/CMakeLists.txt
+1
-0
serving/core/http_process.cc
serving/core/http_process.cc
+8
-6
未找到文件。
serving/CMakeLists.txt
浏览文件 @
9ab4f123
...
...
@@ -99,6 +99,7 @@ add_executable(ms_serving ${SERVING_SRC})
target_link_libraries
(
ms_serving mindspore::event mindspore::event_pthreads
)
target_link_libraries
(
ms_serving
${
_REFLECTION
}
${
_GRPC_GRPCPP
}
${
_PROTOBUF_LIBPROTOBUF
}
pthread
)
set_target_properties
(
ms_serving PROPERTIES POSITION_INDEPENDENT_CODE ON
)
if
(
ENABLE_D
)
add_compile_definitions
(
ENABLE_D
)
target_link_libraries
(
ms_serving
${
RUNTIME_LIB
}
)
...
...
serving/core/http_process.cc
浏览文件 @
9ab4f123
...
...
@@ -30,7 +30,7 @@ using nlohmann::json;
namespace
mindspore
{
namespace
serving
{
const
int
BUF_MAX
=
0x
1
FFFFF
;
const
int
BUF_MAX
=
0x
7FF
FFFFF
;
static
constexpr
char
HTTP_DATA
[]
=
"data"
;
static
constexpr
char
HTTP_TENSOR
[]
=
"tensor"
;
enum
HTTP_TYPE
{
TYPE_DATA
=
0
,
TYPE_TENSOR
};
...
...
@@ -46,10 +46,12 @@ Status GetPostMessage(struct evhttp_request *req, std::string *buf) {
if
(
post_size
==
0
)
{
ERROR_INFER_STATUS
(
status
,
INVALID_INPUTS
,
"http message invalid"
);
return
status
;
}
else
if
(
post_size
>
BUF_MAX
)
{
ERROR_INFER_STATUS
(
status
,
INVALID_INPUTS
,
"http message is bigger than 0x7FFFFFFF."
);
return
status
;
}
else
{
size_t
copy_len
=
post_size
>
BUF_MAX
?
BUF_MAX
:
post_size
;
buf
->
resize
(
copy_len
);
memcpy
(
buf
->
data
(),
evbuffer_pullup
(
req
->
input_buffer
,
-
1
),
copy_len
);
buf
->
resize
(
post_size
);
memcpy
(
buf
->
data
(),
evbuffer_pullup
(
req
->
input_buffer
,
-
1
),
post_size
);
return
status
;
}
}
...
...
@@ -85,7 +87,7 @@ Status CheckMessageValid(const json &message_info, HTTP_TYPE *type) {
count
++
;
}
if
(
count
!=
1
)
{
ERROR_INFER_STATUS
(
status
,
INVALID_INPUTS
,
"http message must have only one type of (data, tensor
, text
)"
);
ERROR_INFER_STATUS
(
status
,
INVALID_INPUTS
,
"http message must have only one type of (data, tensor)"
);
return
status
;
}
return
status
;
...
...
@@ -206,7 +208,7 @@ Status TransDataToPredictRequest(const json &message_info, PredictRequest *reque
}
for
(
int
i
=
0
;
i
<
request
->
data_size
();
i
++
)
{
for
(
size_t
j
=
0
;
j
<
tensor_list
[
i
].
shape
().
size
();
++
j
)
{
request
->
mutable_data
(
i
)
->
mutable_tensor_shape
()
->
add_dims
(
tensor_list
[
i
].
shape
()[
i
]);
request
->
mutable_data
(
i
)
->
mutable_tensor_shape
()
->
add_dims
(
tensor_list
[
i
].
shape
()[
j
]);
}
}
return
SUCCESS
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录