提交 b522a4ea 编写于 作者: X xulongteng

fix bug

上级 041352d5
...@@ -30,7 +30,7 @@ using baidu::paddle_serving::predictor::ctr_prediction::Response; ...@@ -30,7 +30,7 @@ using baidu::paddle_serving::predictor::ctr_prediction::Response;
using baidu::paddle_serving::predictor::ctr_prediction::CTRReqInstance; using baidu::paddle_serving::predictor::ctr_prediction::CTRReqInstance;
using baidu::paddle_serving::predictor::ctr_prediction::CTRResInstance; using baidu::paddle_serving::predictor::ctr_prediction::CTRResInstance;
int batch_size = 1; int batch_size = 16;
int sparse_num = 26; int sparse_num = 26;
int dense_num = 13; int dense_num = 13;
int thread_num = 1; int thread_num = 1;
...@@ -95,8 +95,12 @@ int create_req(Request* req, ...@@ -95,8 +95,12 @@ int create_req(Request* req,
return -1; return -1;
} }
// add data // add data
std::vector<std::string> feature_list = // avoid out of boundary
split(data_list[data_index + i], "\t"); int cur_index = data_index + i;
if (cur_index >= data_list.size()) {
cur_index = cur_index % data_list.size();
}
std::vector<std::string> feature_list = split(data_list[cur_index], "\t");
for (int fi = 0; fi < dense_num; fi++) { for (int fi = 0; fi < dense_num; fi++) {
if (feature_list[fi] == "") { if (feature_list[fi] == "") {
ins->add_dense_ids(0.0); ins->add_dense_ids(0.0);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册