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 "ParserFlatbuffersFixture.hpp" |
| 8 | #include "../TfLiteParser.hpp" |
| 9 | |
| 10 | #include <string> |
| 11 | #include <iostream> |
| 12 | |
| 13 | BOOST_AUTO_TEST_SUITE(TensorflowLiteParser) |
| 14 | |
| 15 | struct SoftmaxFixture : public ParserFlatbuffersFixture |
| 16 | { |
| 17 | explicit SoftmaxFixture() |
| 18 | { |
| 19 | m_JsonString = R"( |
| 20 | { |
| 21 | "version": 3, |
| 22 | "operator_codes": [ { "builtin_code": "SOFTMAX" } ], |
| 23 | "subgraphs": [ { |
| 24 | "tensors": [ |
| 25 | { |
| 26 | "shape": [ 1, 7 ], |
| 27 | "type": "UINT8", |
| 28 | "buffer": 0, |
| 29 | "name": "inputTensor", |
| 30 | "quantization": { |
| 31 | "min": [ 0.0 ], |
| 32 | "max": [ 255.0 ], |
| 33 | "scale": [ 1.0 ], |
| 34 | "zero_point": [ 0 ], |
| 35 | } |
| 36 | }, |
| 37 | { |
| 38 | "shape": [ 1, 7 ], |
| 39 | "type": "UINT8", |
| 40 | "buffer": 1, |
| 41 | "name": "outputTensor", |
| 42 | "quantization": { |
| 43 | "min": [ 0.0 ], |
| 44 | "max": [ 255.0 ], |
| 45 | "scale": [ 0.00390625 ], |
| 46 | "zero_point": [ 0 ], |
| 47 | } |
| 48 | } |
| 49 | ], |
| 50 | "inputs": [ 0 ], |
| 51 | "outputs": [ 1 ], |
| 52 | "operators": [ |
| 53 | { |
| 54 | "opcode_index": 0, |
| 55 | "inputs": [ 0 ], |
| 56 | "outputs": [ 1 ], |
| 57 | "builtin_options_type": "SoftmaxOptions", |
| 58 | "builtin_options": { |
| 59 | "beta": 1.0 |
| 60 | }, |
| 61 | "custom_options_format": "FLEXBUFFERS" |
| 62 | } |
| 63 | ], |
| 64 | } ], |
| 65 | "buffers" : [ {}, {} ] |
| 66 | } |
| 67 | )"; |
| 68 | SetupSingleInputSingleOutput("inputTensor", "outputTensor"); |
| 69 | } |
| 70 | }; |
| 71 | |
| 72 | BOOST_FIXTURE_TEST_CASE(ParseSoftmaxLite, SoftmaxFixture) |
| 73 | { |
Derek Lamberti | f90c56d | 2020-01-10 17:14:08 +0000 | [diff] [blame] | 74 | RunTest<2, armnn::DataType::QAsymmU8>(0, { 0, 0, 100, 0, 0, 0, 0 }, { 0, 0, 255, 0, 0, 0, 0 }); |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 75 | } |
| 76 | |
| 77 | BOOST_AUTO_TEST_SUITE_END() |