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

Function batch_process

serving/processor/serving/processor.cc:50–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50int batch_process(void* model_buf, const void* input_data[], int* input_size,
51 void* output_data[], int* output_size) {
52 auto model = static_cast<tensorflow::processor::Model*>(model_buf);
53 if (input_size == 0) {
54 auto model_str = model->DebugString();
55 *output_data = strndup(model_str.c_str(), model_str.length());
56 *output_size = model_str.length();
57 return 200;
58 }
59
60 auto status = model->BatchPredict(input_data, input_size,
61 output_data, output_size);
62 if (!status.ok()) {
63 std::string errmsg = tensorflow::strings::StrCat(
64 "[TensorFlow] Processor predict failed: ",
65 status.error_message());
66 *output_data = strndup(errmsg.c_str(), strlen(errmsg.c_str()));
67 *output_size = strlen(errmsg.c_str());
68 LOG(ERROR) << errmsg;
69 return 500;
70 }
71 return 200;
72}
73
74// TODO: EAS has a higher priority to call async interface.
75// Now we have no implementation of this async interface,

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected