Jan Eilers | e339bf6 | 2020-11-10 18:43:23 +0000 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2020 Arm Ltd and Contributors. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #pragma once |
| 7 | |
| 8 | #include <tensorflow/lite/interpreter.h> |
| 9 | |
| 10 | namespace armnnDelegate |
| 11 | { |
| 12 | |
| 13 | /// Can be used to assign input data from a vector to a model input. |
| 14 | /// Example usage can be found in ResizeTesthelper.hpp |
| 15 | template <typename T> |
| 16 | void FillInput(std::unique_ptr<tflite::Interpreter>& interpreter, int inputIndex, std::vector<T>& inputValues) |
| 17 | { |
| 18 | auto tfLiteDelegateInputId = interpreter->inputs()[inputIndex]; |
| 19 | auto tfLiteDelageInputData = interpreter->typed_tensor<T>(tfLiteDelegateInputId); |
| 20 | for (unsigned int i = 0; i < inputValues.size(); ++i) |
| 21 | { |
| 22 | tfLiteDelageInputData[i] = inputValues[i]; |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | } // namespace armnnDelegate |