From 9bff14458f9950a5d31b9523c62c0bbf79a65fcf Mon Sep 17 00:00:00 2001 From: Matthew Jackson Date: Thu, 12 Sep 2019 09:08:23 +0100 Subject: IVGCVSW-3857 Add Reference FP16 workload support to remaining layers * Adds Reference FP16 support and unit tests for layers not already supported !referencetests:202156 Signed-off-by: Matthew Jackson Change-Id: I6fc9b9ce2809e163f72e27e877025c8fb85d9fbe --- .../reference/test/RefOptimizedNetworkTests.cpp | 61 ---------------------- 1 file changed, 61 deletions(-) (limited to 'src/backends/reference/test/RefOptimizedNetworkTests.cpp') diff --git a/src/backends/reference/test/RefOptimizedNetworkTests.cpp b/src/backends/reference/test/RefOptimizedNetworkTests.cpp index 1a29e73af8..cd3708cc4f 100644 --- a/src/backends/reference/test/RefOptimizedNetworkTests.cpp +++ b/src/backends/reference/test/RefOptimizedNetworkTests.cpp @@ -149,67 +149,6 @@ BOOST_AUTO_TEST_CASE(OptimizeValidateWorkloadsCpuRefMeanLayer) } } -BOOST_AUTO_TEST_CASE(FP16TurboModeTestOnCpuRef) -{ - // Test to check when FP16 Turbo mode set - // it converts the FP32 network to FP16 Network - // add FP32ToFP16 conversion layer after the InputLayer - // add FP16ToFP32 conversion layer after the OutputLayer - // checks the other layers if they are supported in FP16 - // if they are not put the conversion layers before and after - // if they are not supported in FP16 use FP32 instead - // if there are inverse conversion layers remove them with optimization - // at the moment FloorLayer is not supported in FP16 so it rolls back to FP32 - // and inverse conversion layers are removed by the optimizer - armnn::Network net; - - // Defines layers. - auto input = net.AddInputLayer(0); - auto floor = net.AddFloorLayer(); - auto output = net.AddOutputLayer(0); - - // Connects layers. - input->GetOutputSlot(0).Connect(floor->GetInputSlot(0)); - floor->GetOutputSlot(0).Connect(output->GetInputSlot(0)); - - armnn::TensorShape shape({4}); - armnn::TensorInfo info(shape, armnn::DataType::Float32); - input->GetOutputSlot(0).SetTensorInfo(info); - floor->GetOutputSlot(0).SetTensorInfo(info); - - armnn::IRuntime::CreationOptions options; - armnn::IRuntimePtr runtime(armnn::IRuntime::Create(options)); - - std::vector backends = {armnn::Compute::CpuRef}; - - armnn::OptimizerOptions optimizerOptions; - optimizerOptions.m_ReduceFp32ToFp16 = true; - - armnn::IOptimizedNetworkPtr optimizedNet = armnn::Optimize(net, backends, runtime->GetDeviceSpec(), - optimizerOptions); - - std::ostringstream ss; - optimizedNet->SerializeToDot(ss); - - auto inputId = input->GetGuid(); - auto floorId = floor->GetGuid(); - auto outputId = output->GetGuid(); - - std::stringstream expected; - expected << - "digraph Optimized {\n" - " node [shape=\"record\"];\n" - " edge [fontsize=8 fontcolor=\"blue\" fontname=\"arial-bold\"];\n" - " " << inputId << " [label=\"{Input|LayerType : Input\\lBackendID : CpuRef\\l}\"];\n" - " " << floorId << " [label=\"{Floor|LayerType : Floor\\lBackendID : CpuRef\\l}\"];\n" - " " << outputId << " [label=\"{Output|LayerType : Output\\lBackendID : CpuRef\\l}\"];\n" - " " << inputId << " -> " << floorId << " [label=< [4] >];\n" - " " << floorId << " -> " << outputId << " [label=< [4] >];\n" - "}\n"; - - BOOST_TEST(ss.str() == expected.str()); -} - BOOST_AUTO_TEST_CASE(DebugTestOnCpuRef) { armnn::Network net; -- cgit v1.2.1