diff options
author | Matthew Sloyan <matthew.sloyan@arm.com> | 2021-10-18 13:07:49 +0100 |
---|---|---|
committer | Matthew Sloyan <matthew.sloyan@arm.com> | 2021-10-20 16:03:04 +0100 |
commit | 5d7b0a314b3e354a6cbcf15f5dd78b50f1e02774 (patch) | |
tree | 3d844c4575193ffddfe3a17c51cb808c9f16ddb0 /src/armnnSerializer/test/SerializerTests.cpp | |
parent | 73010788725f8f07efb6df20711ece712ee213ea (diff) | |
download | armnn-5d7b0a314b3e354a6cbcf15f5dd78b50f1e02774.tar.gz |
Add ConstTensorsAsInput support for Conv3d
* Constant weights and biases are now stored as Constant layers.
* Updated Serializer, Deserializer and unit tests to reflect this.
* Updated TfLiteParser.
* Updated Ref backend to handle constant weights and
bias as inputs rather than reading from member variables.
* Added Conv3d EndToEnd test.
* Added NCDHW DataLayout and unit tests.
Signed-off-by: Matthew Sloyan <matthew.sloyan@arm.com>
Change-Id: I10cdd354ca5f1c748730f92ffdb36bf810f83c8e
Diffstat (limited to 'src/armnnSerializer/test/SerializerTests.cpp')
-rw-r--r-- | src/armnnSerializer/test/SerializerTests.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/armnnSerializer/test/SerializerTests.cpp b/src/armnnSerializer/test/SerializerTests.cpp index f2c9852607..2bffe0b9fd 100644 --- a/src/armnnSerializer/test/SerializerTests.cpp +++ b/src/armnnSerializer/test/SerializerTests.cpp @@ -472,25 +472,26 @@ TEST_CASE("SerializeConvolution3d") armnn::INetworkPtr network = armnn::INetwork::Create(); armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(0); - armnn::IConnectableLayer* const convLayer = - network->AddConvolution3dLayer(descriptor, - weights, - armnn::Optional<armnn::ConstTensor>(biases), - layerName.c_str()); + armnn::IConnectableLayer* const weightsLayer = network->AddConstantLayer(weights, "Weights"); + armnn::IConnectableLayer* const biasesLayer = network->AddConstantLayer(biases, "Biases"); + armnn::IConnectableLayer* const convLayer = network->AddConvolution3dLayer(descriptor, layerName.c_str()); armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0); inputLayer->GetOutputSlot(0).Connect(convLayer->GetInputSlot(0)); + weightsLayer->GetOutputSlot(0).Connect(convLayer->GetInputSlot(1)); + biasesLayer->GetOutputSlot(0).Connect(convLayer->GetInputSlot(2)); convLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0)); inputLayer->GetOutputSlot(0).SetTensorInfo(inputInfo); + weightsLayer->GetOutputSlot(0).SetTensorInfo(weightsInfo); + biasesLayer->GetOutputSlot(0).SetTensorInfo(biasesInfo); convLayer->GetOutputSlot(0).SetTensorInfo(outputInfo); armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network)); CHECK(deserializedNetwork); - const std::vector<armnn::ConstTensor>& constants {weights, biases}; - LayerVerifierBaseWithDescriptorAndConstants<armnn::Convolution3dDescriptor> verifier( - layerName, {inputInfo}, {outputInfo}, descriptor, constants); + LayerVerifierBaseWithDescriptor<armnn::Convolution3dDescriptor> verifier( + layerName, {inputInfo, weightsInfo, biasesInfo}, {outputInfo}, descriptor); deserializedNetwork->ExecuteStrategy(verifier); } |