diff options
author | Keith Davis <keith.davis@arm.com> | 2022-05-17 10:06:53 +0100 |
---|---|---|
committer | Keith Davis <keith.davis@arm.com> | 2022-05-23 09:59:34 +0100 |
commit | 721e629fa07e65d6a53c093518021e71e48eeac2 (patch) | |
tree | 1f3826741777e5d2cb28be964f46163f49abc271 /src/armnnTestUtils/CreateWorkload.hpp | |
parent | 4a09159930f37dffa51c194ea8b565612bbe8431 (diff) | |
download | armnn-721e629fa07e65d6a53c093518021e71e48eeac2.tar.gz |
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 <keith.davis@arm.com>
Change-Id: I3407815bfdc1cdc01ca0a667b8e4d80d8621783f
Diffstat (limited to 'src/armnnTestUtils/CreateWorkload.hpp')
-rw-r--r-- | src/armnnTestUtils/CreateWorkload.hpp | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/src/armnnTestUtils/CreateWorkload.hpp b/src/armnnTestUtils/CreateWorkload.hpp index 7700a5573a..905b8fa50b 100644 --- a/src/armnnTestUtils/CreateWorkload.hpp +++ b/src/armnnTestUtils/CreateWorkload.hpp @@ -2122,9 +2122,15 @@ std::pair<armnn::IOptimizedNetworkPtr, std::unique_ptr<PreCompiledWorkload>> Cre convDesc2d.m_BiasEnabled = biasEnabled; convDesc2d.m_DataLayout = armnn::DataLayout::NHWC; - armnn::IConnectableLayer* convLayer = nullptr; + const std::string convLayerName("conv layer"); + armnn::IConnectableLayer* convLayer = net->AddConvolution2dLayer(convDesc2d, convLayerName.c_str()); + + IConnectableLayer* weightsLayer = net->AddConstantLayer(weights); + weightsLayer->GetOutputSlot(0).SetTensorInfo(weights.GetInfo()); + weightsLayer->GetOutputSlot(0).Connect(convLayer->GetInputSlot(1u)); + if (biasEnabled) { constexpr armnn::DataType biasDataType = ( dataType == armnn::DataType::QAsymmU8) ? @@ -2139,23 +2145,10 @@ std::pair<armnn::IOptimizedNetworkPtr, std::unique_ptr<PreCompiledWorkload>> Cre armnn::ConstTensor biases(biasTensorInfo, biasData); - // Create convolution layer with biases - ARMNN_NO_DEPRECATE_WARN_BEGIN - convLayer = net->AddConvolution2dLayer(convDesc2d, - weights, - Optional<ConstTensor>(biases), - convLayerName.c_str()); - ARMNN_NO_DEPRECATE_WARN_END - } - else - { - // Create convolution layer without biases - ARMNN_NO_DEPRECATE_WARN_BEGIN - convLayer = net->AddConvolution2dLayer(convDesc2d, - weights, - EmptyOptional(), - convLayerName.c_str()); - ARMNN_NO_DEPRECATE_WARN_END + IConnectableLayer* biasLayer = net->AddConstantLayer(biases); + + biasLayer->GetOutputSlot(0).SetTensorInfo(biases.GetInfo()); + biasLayer->GetOutputSlot(0).Connect(convLayer->GetInputSlot(2u)); } CHECK(convLayer); |