blob: 11a2a0d84b6c783ef92ef3d29ddadb21d683a4cd [file] [log] [blame]
telsoa01c577f2c2018-08-31 09:22:23 +01001//
2// Copyright © 2017 Arm Ltd. All rights reserved.
David Beckecb56cd2018-09-05 12:52:57 +01003// SPDX-License-Identifier: MIT
telsoa01c577f2c2018-08-31 09:22:23 +01004//
5
telsoa01c577f2c2018-08-31 09:22:23 +01006#include "ParserFlatbuffersFixture.hpp"
7#include "../TfLiteParser.hpp"
8
9#include <string>
10#include <iostream>
11
Sadik Armagan1625efc2021-06-10 18:24:34 +010012TEST_SUITE("TensorflowLiteParser_Softmax")
13{
telsoa01c577f2c2018-08-31 09:22:23 +010014struct SoftmaxFixture : public ParserFlatbuffersFixture
15{
16 explicit SoftmaxFixture()
17 {
18 m_JsonString = R"(
19 {
20 "version": 3,
21 "operator_codes": [ { "builtin_code": "SOFTMAX" } ],
22 "subgraphs": [ {
23 "tensors": [
24 {
25 "shape": [ 1, 7 ],
26 "type": "UINT8",
27 "buffer": 0,
28 "name": "inputTensor",
29 "quantization": {
30 "min": [ 0.0 ],
31 "max": [ 255.0 ],
32 "scale": [ 1.0 ],
33 "zero_point": [ 0 ],
34 }
35 },
36 {
37 "shape": [ 1, 7 ],
38 "type": "UINT8",
39 "buffer": 1,
40 "name": "outputTensor",
41 "quantization": {
42 "min": [ 0.0 ],
43 "max": [ 255.0 ],
44 "scale": [ 0.00390625 ],
45 "zero_point": [ 0 ],
46 }
47 }
48 ],
49 "inputs": [ 0 ],
50 "outputs": [ 1 ],
51 "operators": [
52 {
53 "opcode_index": 0,
54 "inputs": [ 0 ],
55 "outputs": [ 1 ],
56 "builtin_options_type": "SoftmaxOptions",
57 "builtin_options": {
58 "beta": 1.0
59 },
60 "custom_options_format": "FLEXBUFFERS"
61 }
62 ],
63 } ],
64 "buffers" : [ {}, {} ]
65 }
66 )";
67 SetupSingleInputSingleOutput("inputTensor", "outputTensor");
68 }
69};
70
Sadik Armagan1625efc2021-06-10 18:24:34 +010071TEST_CASE_FIXTURE(SoftmaxFixture, "ParseSoftmaxLite")
telsoa01c577f2c2018-08-31 09:22:23 +010072{
Derek Lambertif90c56d2020-01-10 17:14:08 +000073 RunTest<2, armnn::DataType::QAsymmU8>(0, { 0, 0, 100, 0, 0, 0, 0 }, { 0, 0, 255, 0, 0, 0, 0 });
telsoa01c577f2c2018-08-31 09:22:23 +010074}
75
Sadik Armagan1625efc2021-06-10 18:24:34 +010076}