blob: b4b584d70a45fff398650239a17ce50e70dfad42 [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
Finn Williamsdd2ba7e2019-03-01 11:51:52 +00006#include "ParserFlatbuffersSerializeFixture.hpp"
Finn Williams85d36712021-01-26 22:30:06 +00007#include <armnnDeserializer/IDeserializer.hpp>
Finn Williamsdd2ba7e2019-03-01 11:51:52 +00008
9#include <string>
Finn Williamsdd2ba7e2019-03-01 11:51:52 +000010
Sadik Armagan1625efc2021-06-10 18:24:34 +010011TEST_SUITE("Deserializer_Floor")
12{
Finn Williamsdd2ba7e2019-03-01 11:51:52 +000013struct FloorFixture : public ParserFlatbuffersSerializeFixture
14{
15 explicit FloorFixture(const std::string& shape,
16 const std::string& dataType)
17 {
18 m_JsonString = R"(
19 {
20 inputIds: [0],
21 outputIds: [2],
22 layers: [
23 {
24 layer_type: "InputLayer",
25 layer: {
26 base: {
27 layerBindingId: 0,
28 base: {
29 index: 0,
30 layerName: "InputLayer",
31 layerType: "Input",
32 inputSlots: [{
33 index: 0,
34 connection: {sourceLayerIndex:0, outputSlotIndex:0 },
35 }],
36 outputSlots: [ {
37 index: 0,
38 tensorInfo: {
39 dimensions: )" + shape + R"(,
40 dataType: )" + dataType + R"(
41 }}]
42 }
43 }}},
44 {
45 layer_type: "FloorLayer",
46 layer: {
47 base: {
48 index: 1,
49 layerName: "FloorLayer",
50 layerType: "Floor",
51 inputSlots: [{
52 index: 0,
53 connection: {sourceLayerIndex:0, outputSlotIndex:0 },
54 }],
55 outputSlots: [ {
56 index: 0,
57 tensorInfo: {
58 dimensions: )" + shape + R"(,
59 dataType: )" + dataType + R"(
60
61 }}]},
62
63 }},
64 {
65 layer_type: "OutputLayer",
66 layer: {
67 base:{
68 layerBindingId: 2,
69 base: {
70 index: 2,
71 layerName: "OutputLayer",
72 layerType: "Output",
73 inputSlots: [{
74 index: 0,
75 connection: {sourceLayerIndex:1, outputSlotIndex:0 },
76 }],
77 outputSlots: [ {
78 index: 0,
79 tensorInfo: {
80 dimensions: )" + shape + R"(,
81 dataType: )" + dataType + R"(
82 },
83 }],
84 }}},
85 }]
86 }
87 )";
88 Setup();
89 }
90};
91
92
93struct SimpleFloorFixture : FloorFixture
94{
95 SimpleFloorFixture() : FloorFixture("[ 1, 3, 3, 1 ]",
96 "Float32") {}
97};
98
Sadik Armagan1625efc2021-06-10 18:24:34 +010099TEST_CASE_FIXTURE(SimpleFloorFixture, "Floor")
Finn Williamsdd2ba7e2019-03-01 11:51:52 +0000100{
101 RunTest<4, armnn::DataType::Float32>(
102 4,
103 {{"InputLayer", { -37.5f, -15.2f, -8.76f, -2.0f, -1.5f, -1.3f, -0.5f, -0.4f, 0.0f}}},
104 {{"OutputLayer",{ -38.0f, -16.0f, -9.0f, -2.0f, -2.0f, -2.0f, -1.0f, -1.0f, 0.0f}}});
105}
106
107
Sadik Armagan1625efc2021-06-10 18:24:34 +0100108}