diff options
author | Mike Kelly <mike.kelly@arm.com> | 2023-07-07 15:43:06 +0100 |
---|---|---|
committer | Mike Kelly <mike.kelly@arm.com> | 2023-07-14 00:00:53 +0100 |
commit | 4cc341cf8b5a6e6bb0543504cbbfde6fa11a2cdb (patch) | |
tree | 7cac128e9ec6f2fd27f1afdb55f44b870f39e0b3 /src/armnnSerializer/test/SerializerTests.cpp | |
parent | 6963b33221c23af4a8eff19ff4a5773230b0befd (diff) | |
download | armnn-4cc341cf8b5a6e6bb0543504cbbfde6fa11a2cdb.tar.gz |
IVGCVSW-7830 Add backend optimizations to remove Reshapes where possible
* Added optimization to remove reshapes for Neon and Ref Backends
by using overridden TensorInfos
* Added ability to delete Subgraphs during Optimization
* Fixed naming error in NeonEndToEndTests and CLEndToEndTests
* Added LayerNameAndTypeCheck for testing.
* Fixed error where layers were not marked as altered when removed in
CLBackend
Signed-off-by: Mike Kelly <mike.kelly@arm.com>
Change-Id: I1ac25cd4ec9821470d961831ae2c8d24882276cc
Diffstat (limited to 'src/armnnSerializer/test/SerializerTests.cpp')
-rw-r--r-- | src/armnnSerializer/test/SerializerTests.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/armnnSerializer/test/SerializerTests.cpp b/src/armnnSerializer/test/SerializerTests.cpp index 7a988ee134..49971d2ecc 100644 --- a/src/armnnSerializer/test/SerializerTests.cpp +++ b/src/armnnSerializer/test/SerializerTests.cpp @@ -3008,4 +3008,34 @@ TEST_CASE("SerializeDeserializeNonLinearNetwork") deserializedNetwork->ExecuteStrategy(verifier); } +TEST_CASE("SerializeOverriddenSlot") +{ + const std::string layerName("subtraction"); + const armnn::TensorInfo info({ 1, 4 }, armnn::DataType::Float32); + const armnn::TensorInfo incompatibleInfo({ 4, 1 }, armnn::DataType::Float32); + + armnn::INetworkPtr network = armnn::INetwork::Create(); + armnn::IConnectableLayer* const inputLayer0 = network->AddInputLayer(0); + armnn::IConnectableLayer* const inputLayer1 = network->AddInputLayer(1); + armnn::IConnectableLayer* const subtractionLayer = network->AddElementwiseBinaryLayer(armnn::BinaryOperation::Sub, + layerName.c_str()); + armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0); + + inputLayer0->GetOutputSlot(0).Connect(subtractionLayer->GetInputSlot(0)); + inputLayer1->GetOutputSlot(0).Connect(subtractionLayer->GetInputSlot(1)); + subtractionLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0)); + + inputLayer0->GetOutputSlot(0).SetTensorInfo(info); + inputLayer1->GetOutputSlot(0).SetTensorInfo(incompatibleInfo); + subtractionLayer->GetInputSlot(1).SetTensorInfo(info); + subtractionLayer->GetOutputSlot(0).SetTensorInfo(info); + + armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network)); + CHECK(deserializedNetwork); + + LayerVerifierBase verifier(layerName, {info, info}, {info}); + deserializedNetwork->ExecuteStrategy(verifier); +} + + } |