1 // 2 // Copyright © 2017 Arm Ltd. All rights reserved. 3 // SPDX-License-Identifier: MIT 4 // 5 6 #include "ParserFlatbuffersSerializeFixture.hpp" 7 #include <armnnDeserializer/IDeserializer.hpp> 8 9 #include <string> 10 11 TEST_SUITE("Deserializer_Floor") 12 { 13 struct FloorFixture : public ParserFlatbuffersSerializeFixture 14 { FloorFixtureFloorFixture15 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 93 struct SimpleFloorFixture : FloorFixture 94 { SimpleFloorFixtureSimpleFloorFixture95 SimpleFloorFixture() : FloorFixture("[ 1, 3, 3, 1 ]", 96 "Float32") {} 97 }; 98 99 TEST_CASE_FIXTURE(SimpleFloorFixture, "Floor") 100 { 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 108 } 109