MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / process

Function process

serving/processor/serving/processor.cc:26–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24}
25
26int process(void* model_buf, const void* input_data, int input_size,
27 void** output_data, int* output_size) {
28 auto model = static_cast<tensorflow::processor::Model*>(model_buf);
29 if (input_size == 0) {
30 auto model_str = model->DebugString();
31 *output_data = strndup(model_str.c_str(), model_str.length());
32 *output_size = model_str.length();
33 return 200;
34 }
35
36 auto status = model->Predict(input_data, input_size,
37 output_data, output_size);
38 if (!status.ok()) {
39 std::string errmsg = tensorflow::strings::StrCat(
40 "[TensorFlow] Processor predict failed: ",
41 status.error_message());
42 *output_data = strndup(errmsg.c_str(), strlen(errmsg.c_str()));
43 *output_size = strlen(errmsg.c_str());
44 LOG(ERROR) << errmsg;
45 return 500;
46 }
47 return 200;
48}
49
50int batch_process(void* model_buf, const void* input_data[], int* input_size,
51 void* output_data[], int* output_size) {

Callers 1

mainFunction · 0.85

Calls 6

c_strMethod · 0.80
StrCatFunction · 0.50
DebugStringMethod · 0.45
lengthMethod · 0.45
PredictMethod · 0.45
okMethod · 0.45

Tested by 1

mainFunction · 0.68