I'm having a TensorFlow model that takes inputs of shape [1, 128, 1024, 2]. I'd like to run inference on this model with the TensorflowLite C API.
The sample code from the tensorflow/lite/c/c_api.h shows how to feed input into the model:
std::vector<float> inputBuffer(1 * 128 * 1024 * 2);
// populate input buffer
// ...
TfLiteTensor *inputTensor = TfLiteInterpreterGetInputTensor(interpreter, 0);
TfLiteStatus status = TfLiteTensorCopyFromBuffer(inputTensor, inputBuffer.data(), inputBuffer.size() * sizeof(float));
The question is now how to populate the input buffer correctly.
Assuming I am given an array float inputArray[1][128][1024][2], how do I correctly flatten this array to a one-dimensional vector that TensorflowLite can understand?