| 7 | |
| 8 | extern "C" { |
| 9 | void* initialize(const char* model_entry, const char* model_config, |
| 10 | int* state) { |
| 11 | auto model = new tensorflow::processor::Model(std::string(model_entry)); |
| 12 | auto status = model->Init(model_config); |
| 13 | if (!status.ok()) { |
| 14 | std::cerr << "[TensorFlow] Processor initialize failed" |
| 15 | << ", status:" << status.error_message() << std::endl; |
| 16 | *state = -1; |
| 17 | return nullptr; |
| 18 | } |
| 19 | |
| 20 | std::cout << "[TensorFlow] Processor initialize success." << std::endl; |
| 21 | |
| 22 | *state = 0; |
| 23 | return model; |
| 24 | } |
| 25 | |
| 26 | int process(void* model_buf, const void* input_data, int input_size, |
| 27 | void** output_data, int* output_size) { |