aboutsummaryrefslogtreecommitdiff
path: root/delegate/src/test/ArmnnDelegateTest.cpp
diff options
context:
space:
mode:
authorSadik Armagan <sadik.armagan@arm.com>2020-10-19 17:35:30 +0100
committerSadik Armagan <sadik.armagan@arm.com>2020-10-19 16:34:15 +0000
commit3c24f43ff9afb50898d6a73ccddbc0936f72fdad (patch)
treeb4101aab6f085279cddefdc539fb3f622fc8a1b7 /delegate/src/test/ArmnnDelegateTest.cpp
parent418c7dd833accc061ba4cba2743631e582962915 (diff)
downloadarmnn-3c24f43ff9afb50898d6a73ccddbc0936f72fdad.tar.gz
IVGCVSW-5365 'Create the TfLite Delegate subdirectory in ArmNN'
* Created delegate sub-directory under armnn * Created Delegate, ArmnnSubgraph and DelegateOptions classes * Created cmake files. * Integrated doctest (under MIT license) as testing framework Signed-off-by: Sadik Armagan <sadik.armagan@arm.com> Change-Id: If725ebd62c40a97c783cdad22bca48709d44338c
Diffstat (limited to 'delegate/src/test/ArmnnDelegateTest.cpp')
-rw-r--r--delegate/src/test/ArmnnDelegateTest.cpp54
1 files changed, 54 insertions, 0 deletions
diff --git a/delegate/src/test/ArmnnDelegateTest.cpp b/delegate/src/test/ArmnnDelegateTest.cpp
new file mode 100644
index 0000000000..8bd58f6286
--- /dev/null
+++ b/delegate/src/test/ArmnnDelegateTest.cpp
@@ -0,0 +1,54 @@
+//
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#include <armnn_delegate.hpp>
+
+#ifndef DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
+#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
+#endif
+#include <doctest/doctest.h>
+
+#include "tensorflow/lite/kernels/builtin_op_kernels.h"
+#include <tensorflow/lite/interpreter.h>
+
+namespace
+{
+
+
+TEST_SUITE("ArmnnDelegate")
+{
+
+TEST_CASE ("ArmnnDelegate Registered")
+{
+ std::unique_ptr<tflite::impl::Interpreter> tfLiteInterpreter;
+ tfLiteInterpreter.reset(new tflite::impl::Interpreter);
+
+ // Create the network
+ tfLiteInterpreter->AddTensors(3);
+ tfLiteInterpreter->SetInputs({0});
+ tfLiteInterpreter->SetOutputs({2});
+
+ TfLiteQuantizationParams quantizationParams;
+ tfLiteInterpreter->SetTensorParametersReadWrite(0, kTfLiteFloat32, "", {3}, quantizationParams);
+ tfLiteInterpreter->SetTensorParametersReadWrite(1, kTfLiteFloat32, "", {3}, quantizationParams);
+ tfLiteInterpreter->SetTensorParametersReadWrite(2, kTfLiteFloat32, "", {3}, quantizationParams);
+ TfLiteRegistration* nodeRegistration = tflite::ops::builtin::Register_ABS();
+ void* data = malloc(sizeof(int));
+
+ tfLiteInterpreter->AddNodeWithParameters({0}, {2}, nullptr, 0, data, nodeRegistration);
+
+ // create the Armnn Delegate
+ auto delegateOptions = TfLiteArmnnDelegateOptionsDefault();
+ auto delegate = TfLiteArmnnDelegateCreate(delegateOptions);
+ auto status = tfLiteInterpreter->ModifyGraphWithDelegate(std::move(delegate));
+ CHECK(status == kTfLiteOk);
+ CHECK(tfLiteInterpreter != nullptr);
+
+}
+
+}
+
+} // anonymous namespace
+