From 5d955cf70ae0c5558d4f431f0fc6bd4552cd43a5 Mon Sep 17 00:00:00 2001 From: Nikhil Raj Date: Mon, 19 Apr 2021 16:59:48 +0100 Subject: IVGCVSW-5721 Remove the Tensorflow Parser from ArmNN Signed-off-by: Nikhil Raj Change-Id: Ida37d3ee3a1af0c75aa905199bd861726c646846 --- src/armnnTfParser/test/Assert.cpp | 299 -------------------------------------- 1 file changed, 299 deletions(-) delete mode 100644 src/armnnTfParser/test/Assert.cpp (limited to 'src/armnnTfParser/test/Assert.cpp') diff --git a/src/armnnTfParser/test/Assert.cpp b/src/armnnTfParser/test/Assert.cpp deleted file mode 100644 index 0665be7c7e..0000000000 --- a/src/armnnTfParser/test/Assert.cpp +++ /dev/null @@ -1,299 +0,0 @@ -// -// Copyright © 2017 Arm Ltd. All rights reserved. -// SPDX-License-Identifier: MIT -// - -#include "armnnTfParser/ITfParser.hpp" -#include "ParserPrototxtFixture.hpp" -#include "test/GraphUtils.hpp" - -#include - -#include - -BOOST_AUTO_TEST_SUITE(TensorflowParser) - -struct AssertSimpleFixture : public armnnUtils::ParserPrototxtFixture -{ - AssertSimpleFixture() - { - // Placeholder AssertInput - // | \ / - // Add ------ Assert - - m_Prototext = R"( - node { - name: "Placeholder" - op: "Placeholder" - attr { - key: "dtype" - value { - type: DT_FLOAT - } - } - attr { - key: "shape" - value { - shape { - unknown_rank: true - } - } - } - } - node { - name: "AssertInput" - op: "Const" - attr { - key: "dtype" - value { - type: DT_FLOAT - } - } - attr { - key: "value" - value { - tensor { - dtype: DT_FLOAT - tensor_shape { - dim { - size: 1 - } - } - float_val: 17.0 - } - } - } - } - node { - name: "Assert" - op: "Assert" - input: "Placeholder" - input: "AssertInput" - attr { - key: "T" - value { - type: DT_FLOAT - } - } - } - node { - name: "Add" - op: "Add" - input: "Placeholder" - input: "Placeholder" - input: "^Assert" - attr { - key: "T" - value { - type: DT_FLOAT - } - } - })"; - } -}; - -BOOST_FIXTURE_TEST_CASE(AssertSimpleTest, AssertSimpleFixture) -{ - SetupSingleInputSingleOutput({ 1, 1, 1, 4 }, "Placeholder", "Add"); - RunTest<4>({ 1.0f, 2.0f, 3.0f, 4.0f }, { 2.0f, 4.0f, 6.0f, 8.0f }); -} - -BOOST_FIXTURE_TEST_CASE(AssertSimpleGraphStructureTest, AssertSimpleFixture) -{ - auto optimized = SetupOptimizedNetwork({ { "Placeholder", { 1, 1, 1, 4 } } }, { "Add" }); - - armnn::Graph& graph = GetGraphForTesting(optimized.get()); - - BOOST_TEST((graph.GetNumInputs() == 1)); - BOOST_TEST((graph.GetNumOutputs() == 1)); - BOOST_TEST((graph.GetNumLayers() == 3)); - - armnn::Layer* inputLayer = GetFirstLayerWithName(graph, "Placeholder"); - BOOST_TEST((inputLayer->GetType() == armnn::LayerType::Input)); - BOOST_TEST(CheckNumberOfInputSlot(inputLayer, 0)); - BOOST_TEST(CheckNumberOfOutputSlot(inputLayer, 1)); - - armnn::Layer* addLayer = GetFirstLayerWithName(graph, "Add"); - BOOST_TEST((addLayer->GetType() == armnn::LayerType::Addition)); - BOOST_TEST(CheckNumberOfInputSlot(addLayer, 2)); - BOOST_TEST(CheckNumberOfOutputSlot(addLayer, 1)); - - armnn::TensorInfo tensorInfo(armnn::TensorShape({1, 1, 1, 4}), armnn::DataType::Float32); - BOOST_TEST(IsConnected(inputLayer, addLayer, 0, 0, tensorInfo)); - BOOST_TEST(IsConnected(inputLayer, addLayer, 0, 1, tensorInfo)); - - for (auto&& outputLayer : graph.GetOutputLayers()) - { - BOOST_TEST(IsConnected(addLayer, const_cast(outputLayer), 0, 0, tensorInfo)); - } -} - -struct AssertFixture : public armnnUtils::ParserPrototxtFixture -{ - AssertFixture() - { - // Input0 Input1 Input2 - // | \ / | - // | Sub ------ Assert - // \ / / - // Output ------- - - m_Prototext = R"( - node { - name: "Input0" - op: "Placeholder" - attr { - key: "dtype" - value { - type: DT_FLOAT - } - } - attr { - key: "shape" - value { - shape { - unknown_rank: true - } - } - } - } - node { - name: "Input1" - op: "Placeholder" - attr { - key: "dtype" - value { - type: DT_FLOAT - } - } - attr { - key: "shape" - value { - shape { - unknown_rank: true - } - } - } - } - node { - name: "Sub" - op: "Sub" - input: "Input0" - input: "Input1" - attr { - key: "T" - value { - type: DT_FLOAT - } - } - } - node { - name: "Input2" - op: "Placeholder" - attr { - key: "dtype" - value { - type: DT_FLOAT - } - } - attr { - key: "shape" - value { - shape { - unknown_rank: true - } - } - } - } - node { - name: "Assert" - op: "Assert" - input: "Input2" - input: "Sub" - attr { - key: "T" - value { - type: DT_FLOAT - } - } - } - node { - name: "Output" - op: "Add" - input: "Input0" - input: "Sub" - input: "^Assert" - attr { - key: "T" - value { - type: DT_FLOAT - } - } - })"; - - - } -}; - -BOOST_FIXTURE_TEST_CASE(AssertTest, AssertFixture) -{ - Setup({ { "Input0", { 1, 1, 2, 2 } }, - { "Input1", { 1, 1, 2, 2 } } }, - { "Output" }); - - RunTest<4>({ { "Input0", { 4.0f, 3.0f, - 2.0f, 1.0f } }, - - { "Input1", { 1.0f, 2.0f, - 3.0f, 4.0f } } }, - - { { "Output", { 7.0f, 4.0f, - 1.0f, -2.0f } } }); -} - -BOOST_FIXTURE_TEST_CASE(AssertGraphStructureTest, AssertFixture) -{ - auto optimized = SetupOptimizedNetwork({ { "Input0", { 1, 1, 2, 2 } }, - { "Input1", { 1, 1, 2, 2 } } }, - { "Output" }); - - armnn::Graph& graph = GetGraphForTesting(optimized.get()); - - BOOST_TEST((graph.GetNumInputs() == 2)); - BOOST_TEST((graph.GetNumOutputs() == 1)); - BOOST_TEST((graph.GetNumLayers() == 5)); - - armnn::Layer* inputLayer0 = GetFirstLayerWithName(graph, "Input0"); - BOOST_TEST((inputLayer0->GetType() == armnn::LayerType::Input)); - BOOST_TEST(CheckNumberOfInputSlot(inputLayer0, 0)); - BOOST_TEST(CheckNumberOfOutputSlot(inputLayer0, 1)); - - armnn::Layer* inputLayer1 = GetFirstLayerWithName(graph, "Input1"); - BOOST_TEST((inputLayer1->GetType() == armnn::LayerType::Input)); - BOOST_TEST(CheckNumberOfInputSlot(inputLayer1, 0)); - BOOST_TEST(CheckNumberOfOutputSlot(inputLayer1, 1)); - - armnn::Layer* subLayer = GetFirstLayerWithName(graph, "Sub"); - BOOST_TEST((subLayer->GetType() == armnn::LayerType::Subtraction)); - BOOST_TEST(CheckNumberOfInputSlot(subLayer, 2)); - BOOST_TEST(CheckNumberOfOutputSlot(subLayer, 1)); - - armnn::Layer* addLayer = GetFirstLayerWithName(graph, "Output"); - BOOST_TEST((addLayer->GetType() == armnn::LayerType::Addition)); - BOOST_TEST(CheckNumberOfInputSlot(addLayer, 2)); - BOOST_TEST(CheckNumberOfOutputSlot(addLayer, 1)); - - armnn::TensorInfo tensorInfo(armnn::TensorShape({1, 1, 2, 2}), armnn::DataType::Float32); - BOOST_TEST(IsConnected(inputLayer0, subLayer, 0, 0, tensorInfo)); - BOOST_TEST(IsConnected(inputLayer1, subLayer, 0, 1, tensorInfo)); - BOOST_TEST(IsConnected(inputLayer0, addLayer, 0, 0, tensorInfo)); - BOOST_TEST(IsConnected(subLayer, addLayer, 0, 1, tensorInfo)); - - for (auto&& outputLayer : graph.GetOutputLayers()) - { - BOOST_TEST(IsConnected(addLayer, const_cast(outputLayer), 0, 0, tensorInfo)); - } -} - - -BOOST_AUTO_TEST_SUITE_END() -- cgit v1.2.1