提交 dfbda670 编写于 作者: W wangguibao

Fix documentation

上级 00f3bc8e
...@@ -57,6 +57,15 @@ std::vector<std::string> split(const std::string& str, ...@@ -57,6 +57,15 @@ std::vector<std::string> split(const std::string& str,
return res; return res;
} }
/**
* Simulate CPython hash function on string objects
*
* Our model training process use this function to convert string objects to
* unique ids.
*
* See string_hash() in
* https://svn.python.org/projects/python/trunk/Objects/stringobject.c
*/
int64_t hash(std::string str) { int64_t hash(std::string str) {
int64_t len; int64_t len;
unsigned char* p; unsigned char* p;
...@@ -121,7 +130,7 @@ void print_res(const Request& req, ...@@ -121,7 +130,7 @@ void print_res(const Request& req,
for (uint32_t i = 0; i < res.predictions_size(); ++i) { for (uint32_t i = 0; i < res.predictions_size(); ++i) {
const CTRResInstance& res_ins = res.predictions(i); const CTRResInstance& res_ins = res.predictions(i);
std::ostringstream oss; std::ostringstream oss;
oss << res_ins.prob0() << " "; oss << "[" << res_ins.prob0() << " " << res_ins.prob1() << "]";
LOG(INFO) << "Receive result " << oss.str(); LOG(INFO) << "Receive result " << oss.str();
} }
LOG(INFO) << "Succ call predictor[ctr_prediction_service], the tag is: " LOG(INFO) << "Succ call predictor[ctr_prediction_service], the tag is: "
...@@ -141,7 +150,6 @@ void thread_worker(PredictorApi* api, ...@@ -141,7 +150,6 @@ void thread_worker(PredictorApi* api,
std::string line; std::string line;
int turns = 0; int turns = 0;
while (turns < 1000) { while (turns < 1000) {
///
timeval start; timeval start;
gettimeofday(&start, NULL); gettimeofday(&start, NULL);
api->thrd_clear(); api->thrd_clear();
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include "demo-serving/op/ctr_prediction_op.h" #include "demo-serving/op/ctr_prediction_op.h"
#include <algorithm> #include <algorithm>
#include <string> #include <string>
#if 1 #if 0
#include <iomanip> #include <iomanip>
#endif #endif
#include "cube/cube-api/include/cube_api.h" #include "cube/cube-api/include/cube_api.h"
...@@ -120,7 +120,7 @@ int CTRPredictionOp::inference() { ...@@ -120,7 +120,7 @@ int CTRPredictionOp::inference() {
} }
} }
#if 1 #if 0
for (int i = 0; i < keys.size(); ++i) { for (int i = 0; i < keys.size(); ++i) {
std::ostringstream oss; std::ostringstream oss;
oss << keys[i] << ": "; oss << keys[i] << ": ";
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册