diff options
author | Cathal Corbett <cathal.corbett@arm.com> | 2022-05-12 15:54:58 +0100 |
---|---|---|
committer | Cathal Corbett <cathal.corbett@arm.com> | 2022-05-17 15:27:23 +0000 |
commit | 8bd536064f32b1ce521875e2bc8dd24044c4f5c3 (patch) | |
tree | 76bbaccf935d33b1ea57daf9cd32f58f8d04f903 /src/armnn/test/optimizations | |
parent | 9734f0911cdf68e1a7ba8b38167bb958436bc708 (diff) | |
download | armnn-8bd536064f32b1ce521875e2bc8dd24044c4f5c3.tar.gz |
IVGCVSW-6126 ConstTensorsAsInput: Conv2d - Backends
!android-nn-driver:7477
Signed-off-by: Cathal Corbett <cathal.corbett@arm.com>
Change-Id: Ibf633ccccc385bd980934ff829407d21981323ef
Diffstat (limited to 'src/armnn/test/optimizations')
-rw-r--r-- | src/armnn/test/optimizations/FuseActivationTests.cpp | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/src/armnn/test/optimizations/FuseActivationTests.cpp b/src/armnn/test/optimizations/FuseActivationTests.cpp index 0cca86f93b..3b8917192d 100644 --- a/src/armnn/test/optimizations/FuseActivationTests.cpp +++ b/src/armnn/test/optimizations/FuseActivationTests.cpp @@ -56,32 +56,35 @@ struct Convolution2dTest float scale = 1.f, int32_t offset = 0) { + IgnoreUnused(scale); + IgnoreUnused(offset); + Convolution2dDescriptor descriptor; descriptor.m_DataLayout = DataLayout::NHWC; descriptor.m_StrideX = 1; descriptor.m_StrideY = 1; + return network->AddConvolution2dLayer(descriptor, name); + } + + static std::vector<IConnectableLayer*> AddConstantLayers(INetwork* network, + float scale = 1.f, + int32_t offset = 0) + { + std::vector<float> weightsData = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42}; + 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42 }; std::vector<T> weightsVector = armnnUtils::QuantizedVector<T>(weightsData, scale, offset); TensorInfo weightsInfo(GetWeightsShape(), ArmnnType, scale, offset, true); ConstTensor weights(weightsInfo, weightsVector); - Optional<ConstTensor> optionalBias; - ARMNN_NO_DEPRECATE_WARN_BEGIN - return network->AddConvolution2dLayer(descriptor, weights, optionalBias, name); - ARMNN_NO_DEPRECATE_WARN_END - } - static std::vector<IConnectableLayer*> AddConstantLayers(INetwork* network, - float scale = 1.f, - int32_t offset = 0) - { - IgnoreUnused(network); - IgnoreUnused(scale); - IgnoreUnused(offset); - return {}; + IConnectableLayer* weightsLayer = network->AddConstantLayer(weights, "Weights"); + weightsLayer->GetOutputSlot(0).SetTensorInfo(weightsInfo); + + std::vector<IConnectableLayer*> layers = { weightsLayer }; + return layers; } }; |