| 131 | |
| 132 | template <typename T> |
| 133 | void StridedSliceTestImpl(std::vector<T>& inputValues, |
| 134 | std::vector<T>& expectedOutputValues, |
| 135 | std::vector<int32_t>& beginTensorData, |
| 136 | std::vector<int32_t>& endTensorData, |
| 137 | std::vector<int32_t>& strideTensorData, |
| 138 | std::vector<int32_t>& inputTensorShape, |
| 139 | std::vector<int32_t>& beginTensorShape, |
| 140 | std::vector<int32_t>& endTensorShape, |
| 141 | std::vector<int32_t>& strideTensorShape, |
| 142 | std::vector<int32_t>& outputTensorShape, |
| 143 | const std::vector<armnn::BackendId>& backends = {}, |
| 144 | const int32_t beginMask = 0, |
| 145 | const int32_t endMask = 0, |
| 146 | const int32_t ellipsisMask = 0, |
| 147 | const int32_t newAxisMask = 0, |
| 148 | const int32_t ShrinkAxisMask = 0, |
| 149 | const armnn::DataLayout& dataLayout = armnn::DataLayout::NHWC) |
| 150 | { |
| 151 | using namespace delegateTestInterpreter; |
| 152 | std::vector<char> modelBuffer = CreateStridedSliceTfLiteModel( |
| 153 | ::tflite::TensorType_FLOAT32, |
| 154 | inputTensorShape, |
| 155 | beginTensorData, |
| 156 | endTensorData, |
| 157 | strideTensorData, |
| 158 | beginTensorShape, |
| 159 | endTensorShape, |
| 160 | strideTensorShape, |
| 161 | outputTensorShape, |
| 162 | beginMask, |
| 163 | endMask, |
| 164 | ellipsisMask, |
| 165 | newAxisMask, |
| 166 | ShrinkAxisMask, |
| 167 | dataLayout); |
| 168 | |
| 169 | // Setup interpreter with just TFLite Runtime. |
| 170 | auto tfLiteInterpreter = DelegateTestInterpreter(modelBuffer); |
| 171 | CHECK(tfLiteInterpreter.AllocateTensors() == kTfLiteOk); |
| 172 | CHECK(tfLiteInterpreter.FillInputTensor<T>(inputValues, 0) == kTfLiteOk); |
| 173 | CHECK(tfLiteInterpreter.Invoke() == kTfLiteOk); |
| 174 | std::vector<T> tfLiteOutputValues = tfLiteInterpreter.GetOutputResult<T>(0); |
| 175 | std::vector<int32_t> tfLiteOutputShape = tfLiteInterpreter.GetOutputShape(0); |
| 176 | |
| 177 | // Setup interpreter with Arm NN Delegate applied. |
| 178 | auto armnnInterpreter = DelegateTestInterpreter(modelBuffer, CaptureAvailableBackends(backends)); |
| 179 | CHECK(armnnInterpreter.AllocateTensors() == kTfLiteOk); |
| 180 | CHECK(armnnInterpreter.FillInputTensor<T>(inputValues, 0) == kTfLiteOk); |
| 181 | CHECK(armnnInterpreter.Invoke() == kTfLiteOk); |
| 182 | std::vector<T> armnnOutputValues = armnnInterpreter.GetOutputResult<T>(0); |
| 183 | std::vector<int32_t> armnnOutputShape = armnnInterpreter.GetOutputShape(0); |
| 184 | |
| 185 | armnnDelegate::CompareOutputData<T>(tfLiteOutputValues, armnnOutputValues, expectedOutputValues); |
| 186 | armnnDelegate::CompareOutputShape(tfLiteOutputShape, armnnOutputShape, outputTensorShape); |
| 187 | |
| 188 | tfLiteInterpreter.Cleanup(); |
| 189 | armnnInterpreter.Cleanup(); |
| 190 | } // End of StridedSlice Test |
nothing calls this directly
no test coverage detected