From 721e629fa07e65d6a53c093518021e71e48eeac2 Mon Sep 17 00:00:00 2001 From: Keith Davis Date: Tue, 17 May 2022 10:06:53 +0100 Subject: IVGCVSW-6123 ConstTensorsAsInputs: Conv2d * Use new INetwork::AddConvolution2dLayer instead of deprecated version * Remove duplicated test in SerlializerTests * Fix some cosmetics Signed-off-by: Keith Davis Change-Id: I3407815bfdc1cdc01ca0a667b8e4d80d8621783f --- src/armnnSerializer/test/SerializerTests.cpp | 55 +--------------------------- 1 file changed, 1 insertion(+), 54 deletions(-) (limited to 'src/armnnSerializer/test/SerializerTests.cpp') diff --git a/src/armnnSerializer/test/SerializerTests.cpp b/src/armnnSerializer/test/SerializerTests.cpp index a042939265..43a8aae9a7 100644 --- a/src/armnnSerializer/test/SerializerTests.cpp +++ b/src/armnnSerializer/test/SerializerTests.cpp @@ -417,7 +417,7 @@ TEST_CASE("SerializeConvolution2d") deserializedNetwork->ExecuteStrategy(verifier); } -TEST_CASE("SerializeConvolution2dWithPerAxisParams") +TEST_CASE("SerializeConvolution2dWithPerAxisParamsTestDeprecatedMethod") { using namespace armnn; @@ -473,59 +473,6 @@ TEST_CASE("SerializeConvolution2dWithPerAxisParams") deserializedNetwork->ExecuteStrategy(verifier); } -TEST_CASE("SerializeConvolution2dWeightsAndBiasesAsConstantLayers") -{ - const std::string layerName("convolution2d"); - const armnn::TensorInfo inputInfo ({ 1, 5, 5, 1 }, armnn::DataType::Float32); - const armnn::TensorInfo outputInfo({ 1, 3, 3, 1 }, armnn::DataType::Float32); - - const armnn::TensorInfo weightsInfo({ 1, 3, 3, 1 }, armnn::DataType::Float32, 0.0f, 0, true); - const armnn::TensorInfo biasesInfo ({ 1 }, armnn::DataType::Float32, 0.0f, 0, true); - - std::vector weightsData = GenerateRandomData(weightsInfo.GetNumElements()); - armnn::ConstTensor weights(weightsInfo, weightsData); - - std::vector biasesData = GenerateRandomData(biasesInfo.GetNumElements()); - armnn::ConstTensor biases(biasesInfo, biasesData); - - armnn::Convolution2dDescriptor descriptor; - descriptor.m_PadLeft = 1; - descriptor.m_PadRight = 1; - descriptor.m_PadTop = 1; - descriptor.m_PadBottom = 1; - descriptor.m_StrideX = 2; - descriptor.m_StrideY = 2; - descriptor.m_DilationX = 2; - descriptor.m_DilationY = 2; - descriptor.m_BiasEnabled = true; - descriptor.m_DataLayout = armnn::DataLayout::NHWC; - - armnn::INetworkPtr network = armnn::INetwork::Create(); - armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(0); - armnn::IConnectableLayer* const weightsLayer = network->AddConstantLayer(weights, "Weights"); - armnn::IConnectableLayer* const biasesLayer = network->AddConstantLayer(biases, "Biases"); - armnn::IConnectableLayer* const convLayer = network->AddConvolution2dLayer(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); - - Convolution2dLayerVerifier verifier(layerName, {inputInfo, weightsInfo, biasesInfo}, {outputInfo}, descriptor); - - deserializedNetwork->ExecuteStrategy(verifier); -} - TEST_CASE("SerializeConvolution2dWeightsAndBiasesAsConstantLayers") { const std::string layerName("convolution2d"); -- cgit v1.2.1