diff options
author | David Monahan <david.monahan@arm.com> | 2020-03-13 07:52:54 +0000 |
---|---|---|
committer | Jim Flynn <jim.flynn@arm.com> | 2020-03-13 19:09:07 +0000 |
commit | 0a99a1469f6ca683df65937ae3ad217b732d01c5 (patch) | |
tree | 292b719fb0acec07e4e7c7796c744063701da432 /src/backends/backendsCommon/test | |
parent | de36e4a9c299028e792c3a5bd99ad0816d806077 (diff) | |
download | armnn-0a99a1469f6ca683df65937ae3ad217b732d01c5.tar.gz |
IVGCVSW-4531 Fix for failing strided slice NNT/VTS tests on Android R
Signed-off-by: David Monahan <david.monahan@arm.com>
Change-Id: I7f6932f0d21b5678ab9822b0fc69f589bbbb07e5
Diffstat (limited to 'src/backends/backendsCommon/test')
-rw-r--r-- | src/backends/backendsCommon/test/EndToEndTestImpl.hpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/backends/backendsCommon/test/EndToEndTestImpl.hpp b/src/backends/backendsCommon/test/EndToEndTestImpl.hpp index 358f4e3fc2..4221f626da 100644 --- a/src/backends/backendsCommon/test/EndToEndTestImpl.hpp +++ b/src/backends/backendsCommon/test/EndToEndTestImpl.hpp @@ -766,4 +766,40 @@ inline void ExportOutputWithSeveralOutputSlotConnectionsTest(std::vector<Backend BOOST_TEST(found != std::string::npos); } +inline void StridedSliceInvalidSliceEndToEndTest(std::vector<BackendId> backends) +{ + using namespace armnn; + + // Create runtime in which test will run + IRuntime::CreationOptions options; + IRuntimePtr runtime(armnn::IRuntime::Create(options)); + + // build up the structure of the network + INetworkPtr net(INetwork::Create()); + + IConnectableLayer* input = net->AddInputLayer(0); + + // Configure a strided slice with a stride the same size as the input but with a ShrinkAxisMask on the first + // dim of the output to make it too small to hold the specified slice. + StridedSliceDescriptor descriptor; + descriptor.m_Begin = {0, 0}; + descriptor.m_End = {2, 3}; + descriptor.m_Stride = {1, 1}; + descriptor.m_BeginMask = 0; + descriptor.m_EndMask = 0; + descriptor.m_ShrinkAxisMask = 1; + IConnectableLayer* stridedSlice = net->AddStridedSliceLayer(descriptor); + + IConnectableLayer* output0 = net->AddOutputLayer(0); + + input->GetOutputSlot(0).Connect(stridedSlice->GetInputSlot(0)); + stridedSlice->GetOutputSlot(0).Connect(output0->GetInputSlot(0)); + + input->GetOutputSlot(0).SetTensorInfo(TensorInfo({ 2, 3 }, DataType::Float32)); + stridedSlice->GetOutputSlot(0).SetTensorInfo(TensorInfo({ 3 }, DataType::Float32)); + + // Attempt to optimize the network and check that the correct exception is thrown + BOOST_CHECK_THROW(Optimize(*net, backends, runtime->GetDeviceSpec()), armnn::LayerValidationException); +} + } // anonymous namespace |