blob: 211fa1b54b8ab64c913f1cb92dadf94a2313eeda [file] [log] [blame]
Finn Williamsdd2ba7e2019-03-01 11:51:52 +00001//
2// Copyright © 2017 Arm Ltd. All rights reserved.
3// SPDX-License-Identifier: MIT
4//
5
6#include <boost/test/unit_test.hpp>
7#include "ParserFlatbuffersSerializeFixture.hpp"
8#include "../Deserializer.hpp"
9
10#include <string>
11#include <iostream>
12
13BOOST_AUTO_TEST_SUITE(Deserializer)
14
15struct FloorFixture : public ParserFlatbuffersSerializeFixture
16{
17 explicit FloorFixture(const std::string& shape,
18 const std::string& dataType)
19 {
20 m_JsonString = R"(
21 {
22 inputIds: [0],
23 outputIds: [2],
24 layers: [
25 {
26 layer_type: "InputLayer",
27 layer: {
28 base: {
29 layerBindingId: 0,
30 base: {
31 index: 0,
32 layerName: "InputLayer",
33 layerType: "Input",
34 inputSlots: [{
35 index: 0,
36 connection: {sourceLayerIndex:0, outputSlotIndex:0 },
37 }],
38 outputSlots: [ {
39 index: 0,
40 tensorInfo: {
41 dimensions: )" + shape + R"(,
42 dataType: )" + dataType + R"(
43 }}]
44 }
45 }}},
46 {
47 layer_type: "FloorLayer",
48 layer: {
49 base: {
50 index: 1,
51 layerName: "FloorLayer",
52 layerType: "Floor",
53 inputSlots: [{
54 index: 0,
55 connection: {sourceLayerIndex:0, outputSlotIndex:0 },
56 }],
57 outputSlots: [ {
58 index: 0,
59 tensorInfo: {
60 dimensions: )" + shape + R"(,
61 dataType: )" + dataType + R"(
62
63 }}]},
64
65 }},
66 {
67 layer_type: "OutputLayer",
68 layer: {
69 base:{
70 layerBindingId: 2,
71 base: {
72 index: 2,
73 layerName: "OutputLayer",
74 layerType: "Output",
75 inputSlots: [{
76 index: 0,
77 connection: {sourceLayerIndex:1, outputSlotIndex:0 },
78 }],
79 outputSlots: [ {
80 index: 0,
81 tensorInfo: {
82 dimensions: )" + shape + R"(,
83 dataType: )" + dataType + R"(
84 },
85 }],
86 }}},
87 }]
88 }
89 )";
90 Setup();
91 }
92};
93
94
95struct SimpleFloorFixture : FloorFixture
96{
97 SimpleFloorFixture() : FloorFixture("[ 1, 3, 3, 1 ]",
98 "Float32") {}
99};
100
101BOOST_FIXTURE_TEST_CASE(Floor, SimpleFloorFixture)
102{
103 RunTest<4, armnn::DataType::Float32>(
104 4,
105 {{"InputLayer", { -37.5f, -15.2f, -8.76f, -2.0f, -1.5f, -1.3f, -0.5f, -0.4f, 0.0f}}},
106 {{"OutputLayer",{ -38.0f, -16.0f, -9.0f, -2.0f, -2.0f, -2.0f, -1.0f, -1.0f, 0.0f}}});
107}
108
109
110BOOST_AUTO_TEST_SUITE_END()