From 95e73d77b9a79f7d350a39d85f07d09cd58422cc Mon Sep 17 00:00:00 2001 From: Rob Hughes Date: Tue, 24 Sep 2019 09:34:53 +0100 Subject: NNXSW-1826 Move tests for Optimization classes to separate files This splits up the >1000 line OptimizerTests.cpp file. Each Optimization class now has its own test file, all of which are in a subfolder of tests called "optimizations". The original OptimizerTests.cpp now contains mostly (completely?) tests for validating output shapes, which perhaps should be moved to test files specific to the layer types they are testing. Change-Id: Icd1196cad8b720abcb156921aab1adbd4026756b Signed-off-by: Rob Hughes --- .../Fp32NetworkToFp16ConverterTests.cpp | 45 ++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/armnn/test/optimizations/Fp32NetworkToFp16ConverterTests.cpp (limited to 'src/armnn/test/optimizations/Fp32NetworkToFp16ConverterTests.cpp') diff --git a/src/armnn/test/optimizations/Fp32NetworkToFp16ConverterTests.cpp b/src/armnn/test/optimizations/Fp32NetworkToFp16ConverterTests.cpp new file mode 100644 index 0000000000..0e47b3f089 --- /dev/null +++ b/src/armnn/test/optimizations/Fp32NetworkToFp16ConverterTests.cpp @@ -0,0 +1,45 @@ +// +// Copyright © 2017 Arm Ltd. All rights reserved. +// SPDX-License-Identifier: MIT +// + +#include "../TestUtils.hpp" + +#include + +#include + +BOOST_AUTO_TEST_SUITE(Optimizer) +using namespace armnn::optimizations; + +BOOST_AUTO_TEST_CASE(Fp32NetworkToFp16OptimizationTest) +{ + armnn::Graph graph; + + const armnn::TensorInfo infoFP32({ 2, 2, 1, 3 }, armnn::DataType::Float32); + + // Create the simple test network + auto input = graph.AddLayer(0, "input"); + input->GetOutputSlot().SetTensorInfo(infoFP32); + + auto floor = graph.AddLayer("floor"); + floor->GetOutputSlot().SetTensorInfo(infoFP32); + + auto output = graph.AddLayer(1, "output"); + + // Connect up the layers + input->GetOutputSlot().Connect(floor->GetInputSlot(0)); + floor->GetOutputSlot().Connect(output->GetInputSlot(0)); + + BOOST_TEST(CheckSequence(graph.cbegin(), graph.cend(), &IsLayerOfType, + &IsLayerOfType, &IsLayerOfType)); + + // Run the optimizer + armnn::Optimizer::Pass(graph, armnn::MakeOptimizations(Fp32NetworkToFp16Converter())); + + BOOST_TEST(CheckSequence(graph.cbegin(), graph.cend(), &IsLayerOfType, + &IsLayerOfType, &IsLayerOfType, + &IsLayerOfType, &IsLayerOfType)); +} + +BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file -- cgit v1.2.1