#include #include int main() { printf("Hello from TensorFlow C library version %s\n", TfLiteVersion()); int index = 1; TfLiteModel* model = TfLiteModelCreateFromFile("tflite_boosted_sample.tflite"); int input[2] = {12,122}; float output[2] = {0}; TfLiteInterpreterOptions* options; TfLiteInterpreter* interpreter; TfLiteTensor* input_tensor; const TfLiteTensor* output_tensor; for(index=1; index<=1; index++) { options = TfLiteInterpreterOptionsCreate(); TfLiteInterpreterOptionsSetNumThreads(options, 10); interpreter = TfLiteInterpreterCreate(model, options); TfLiteInterpreterAllocateTensors(interpreter); input_tensor = TfLiteInterpreterGetInputTensor(interpreter, 0); TfLiteTensorCopyFromBuffer(input_tensor, &input, 2 * sizeof(int)); //TfLiteTensorCopyFromBuffer(input_tensor, &input, 1 * sizeof(int)); TfLiteInterpreterInvoke(interpreter); output_tensor = TfLiteInterpreterGetOutputTensor(interpreter, 0); TfLiteTensorCopyToBuffer(output_tensor, &output, 2 * sizeof(float)); //TfLiteTensorCopyToBuffer(output_tensor, &output, 1 * sizeof(int)); TfLiteInterpreterDelete(interpreter); TfLiteInterpreterOptionsDelete(options); printf("The prediction index 0 is : <%.6f>\n", output[0]); printf("The prediction index 1 is : <%.6f>\n", output[1]); } TfLiteModelDelete(model); return 0; }