aboutsummaryrefslogtreecommitdiff
path: root/delegate/src/test/ArmnnDelegateTest.cpp
diff options
context:
space:
mode:
authorNarumol Prangnawarat <narumol.prangnawarat@arm.com>2021-01-20 15:58:29 +0000
committerNarumol Prangnawarat <narumol.prangnawarat@arm.com>2021-01-25 17:56:59 +0000
commit0b51d5ad533f8ecde71f957077690195eea29ffc (patch)
treed04aaecd63deb8c67f4cea001bc4ddac3181911c /delegate/src/test/ArmnnDelegateTest.cpp
parente5617954db782628ca49919a627d01ee0088fb67 (diff)
downloadarmnn-0b51d5ad533f8ecde71f957077690195eea29ffc.tar.gz
IVGCVSW-5619 Add OptimizerOptions and NetworkProperties to ArmNN Delegate
* Add OptimizerOptions, NetworkProperties, DebugCallbackFunction to DelegateOptions * Enable OptimizerOptions when the network is being optimized * Enable NetworkProperties when loading network * Enable DebugCallbackFunction * Add error message when loading network * Log warning instead of error when operator is not supported but could fallback to another backend * Improve uint16_t CompareData * Unit tests Signed-off-by: Narumol Prangnawarat <narumol.prangnawarat@arm.com> Change-Id: I353035afb442774bfeb1c62570a90755c2ceaf38
Diffstat (limited to 'delegate/src/test/ArmnnDelegateTest.cpp')
-rw-r--r--delegate/src/test/ArmnnDelegateTest.cpp34
1 files changed, 33 insertions, 1 deletions
diff --git a/delegate/src/test/ArmnnDelegateTest.cpp b/delegate/src/test/ArmnnDelegateTest.cpp
index 84bc31172d..bc73dde2ef 100644
--- a/delegate/src/test/ArmnnDelegateTest.cpp
+++ b/delegate/src/test/ArmnnDelegateTest.cpp
@@ -21,7 +21,7 @@ TEST_SUITE("ArmnnDelegate")
TEST_CASE ("ArmnnDelegate Registered")
{
using namespace tflite;
- auto tfLiteInterpreter = std::make_unique<Interpreter>();
+ auto tfLiteInterpreter = std::make_unique<Interpreter>();
tfLiteInterpreter->AddTensors(3);
tfLiteInterpreter->SetInputs({0, 1});
@@ -56,6 +56,38 @@ TEST_CASE ("ArmnnDelegate Registered")
CHECK(tfLiteInterpreter != nullptr);
}
+TEST_CASE ("ArmnnDelegateOptimizerOptionsRegistered")
+{
+ using namespace tflite;
+ auto tfLiteInterpreter = std::make_unique<Interpreter>();
+
+ tfLiteInterpreter->AddTensors(3);
+ tfLiteInterpreter->SetInputs({0, 1});
+ tfLiteInterpreter->SetOutputs({2});
+
+ tfLiteInterpreter->SetTensorParametersReadWrite(0, kTfLiteFloat32, "input1", {1,2,2,1}, TfLiteQuantization());
+ tfLiteInterpreter->SetTensorParametersReadWrite(1, kTfLiteFloat32, "input2", {1,2,2,1}, TfLiteQuantization());
+ tfLiteInterpreter->SetTensorParametersReadWrite(2, kTfLiteFloat32, "output", {1,2,2,1}, TfLiteQuantization());
+
+ tflite::ops::builtin::BuiltinOpResolver opResolver;
+ const TfLiteRegistration* opRegister = opResolver.FindOp(BuiltinOperator_ADD, 1);
+ tfLiteInterpreter->AddNodeWithParameters({0, 1}, {2}, "", 0, nullptr, opRegister);
+
+ // Create the Armnn Delegate
+ std::vector<armnn::BackendId> backends = { armnn::Compute::CpuRef };
+
+ armnn::OptimizerOptions optimizerOptions(true, true, false, true);
+
+ armnnDelegate::DelegateOptions delegateOptions(backends, optimizerOptions);
+ std::unique_ptr<TfLiteDelegate, decltype(&armnnDelegate::TfLiteArmnnDelegateDelete)>
+ theArmnnDelegate(armnnDelegate::TfLiteArmnnDelegateCreate(delegateOptions),
+ armnnDelegate::TfLiteArmnnDelegateDelete);
+
+ auto status = tfLiteInterpreter->ModifyGraphWithDelegate(std::move(theArmnnDelegate));
+ CHECK(status == kTfLiteOk);
+ CHECK(tfLiteInterpreter != nullptr);
+}
+
}
} // namespace armnnDelegate