telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
David Beck | ecb56cd | 2018-09-05 12:52:57 +0100 | [diff] [blame] | 3 | // SPDX-License-Identifier: MIT |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 4 | // |
| 5 | |
| 6 | #include <boost/test/unit_test.hpp> |
| 7 | #include "armnnOnnxParser/IOnnxParser.hpp" |
| 8 | #include "ParserPrototxtFixture.hpp" |
| 9 | |
| 10 | BOOST_AUTO_TEST_SUITE(OnnxParser) |
| 11 | |
| 12 | struct ReluMainFixture : public armnnUtils::ParserPrototxtFixture<armnnOnnxParser::IOnnxParser> |
| 13 | { |
| 14 | ReluMainFixture() |
| 15 | { |
| 16 | m_Prototext = R"( |
| 17 | ir_version: 3 |
| 18 | producer_name: "CNTK" |
| 19 | producer_version: "2.5.1" |
| 20 | domain: "ai.cntk" |
| 21 | model_version: 1 |
| 22 | graph { |
| 23 | name: "CNTKGraph" |
| 24 | input { |
| 25 | name: "Input" |
| 26 | type { |
| 27 | tensor_type { |
Matteo Martincigh | 44a7167 | 2018-12-11 13:46:52 +0000 | [diff] [blame] | 28 | elem_type: 1 |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 29 | shape { |
| 30 | dim { |
| 31 | dim_value: 4 |
| 32 | } |
| 33 | } |
| 34 | } |
| 35 | } |
| 36 | } |
| 37 | node { |
| 38 | input: "Input" |
| 39 | output: "Output" |
| 40 | name: "ActivationLayer" |
| 41 | op_type: "Relu" |
| 42 | } |
| 43 | output { |
| 44 | name: "Output" |
| 45 | type { |
| 46 | tensor_type { |
Matteo Martincigh | 44a7167 | 2018-12-11 13:46:52 +0000 | [diff] [blame] | 47 | elem_type: 1 |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 48 | shape { |
| 49 | dim { |
| 50 | dim_value: 4 |
| 51 | } |
| 52 | } |
| 53 | } |
| 54 | } |
| 55 | } |
| 56 | } |
| 57 | opset_import { |
| 58 | version: 7 |
| 59 | })"; |
| 60 | Setup(); |
| 61 | } |
| 62 | }; |
| 63 | |
| 64 | BOOST_FIXTURE_TEST_CASE(ValidReluTest, ReluMainFixture) |
| 65 | { |
| 66 | RunTest<1>({{"Input", { -1.0f, -0.5f, 1.25f, -3.0f}}}, |
| 67 | {{ "Output", { 0.0f, 0.0f, 1.25f, 0.0f}}}); |
| 68 | } |
| 69 | |
| 70 | BOOST_AUTO_TEST_SUITE_END() |