2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // See LICENSE file in the project root for full license information.
6 #include <boost/test/unit_test.hpp>
7 #include "armnnTfParser/ITfParser.hpp"
8 #include "ParserPrototxtFixture.hpp"
12 BOOST_AUTO_TEST_SUITE(TensorflowParser)
14 struct DepthwiseConvolution2dFixture : public ParserPrototxtFixture<armnnTfParser::ITfParser>
16 explicit DepthwiseConvolution2dFixture(const char* paddingType)
18 m_Prototext = "node { \n"
19 " name: \"graphInput\" \n"
20 " op: \"Placeholder\" \n"
46 " tensor_content: \"\\000\\000\\200?\\000\\000\\000@\\000\\000@@\\000\\000\\200@"
47 "\\000\\000\\240@\\000\\000\\300@\\000\\000\\340@\\000\\000\\000A\\000\\000\\020A\" \n"
53 " name: \"Const_1\" \n"
80 " tensor_content: \"\\000\\000\\000?\\000\\000\\200?\\000\\000\\000?"
81 "\\000\\000\\000?\\000\\000\\200?\\000\\000\\000?"
82 "\\000\\000\\000?\\000\\000\\200?\\000\\000\\000?"
83 "\\000\\000\\000?\\000\\000\\200?\\000\\000\\000?"
84 "\\000\\000\\000?\\000\\000\\200?\\000\\000\\000?"
85 "\\000\\000\\000?\\000\\000\\200?\\000\\000\\000?"
86 "\\000\\000\\000?\\000\\000\\200?\\000\\000\\000?"
87 "\\000\\000\\000?\\000\\000\\200?\\000\\000\\000?"
88 "\\000\\000\\000?\\000\\000\\200?\\000\\000\\000?\" \n"
94 " name: \"potato\" \n"
95 " op: \"DepthwiseConv2dNative\" \n"
96 " input: \"graphInput\" \n"
97 " input: \"Const_1\" \n"
105 " key: \"data_format\" \n"
111 " key: \"padding\" \n"
114 m_Prototext.append(paddingType);
115 m_Prototext.append("\"\n"
119 " key: \"strides\" \n"
130 " key: \"use_cudnn_on_gpu\" \n"
137 SetupSingleInputSingleOutput({ 1, 1, 3, 3 }, "graphInput", "potato");
141 struct DepthwiseConvolution2dSameFixture : DepthwiseConvolution2dFixture
143 DepthwiseConvolution2dSameFixture() : DepthwiseConvolution2dFixture("SAME") { }
146 BOOST_FIXTURE_TEST_CASE(ParseDepthwiseConv2DSame, DepthwiseConvolution2dSameFixture)
148 RunTest<4>({ 1, 2, 3, 4, 5, 6, 7, 8, 9 },
149 { 2.5f, 5.f, 2.5f, 3.5f, 7.f, 3.5f, 4.5f, 9.f, 4.5f,
150 6.f, 12.f, 6.f, 7.5f, 15.f, 7.5f, 9.f, 18.f, 9.f,
151 5.5f, 11.f, 5.5f, 6.5f, 13.f, 6.5f, 7.5f, 15.f, 7.5f});
154 struct DepthwiseConvolution2dValidFixture : DepthwiseConvolution2dFixture
156 DepthwiseConvolution2dValidFixture() : DepthwiseConvolution2dFixture("VALID") { }
159 BOOST_FIXTURE_TEST_CASE(ParseDepthwiseConv2DValid, DepthwiseConvolution2dValidFixture)
161 RunTest<4>({ 1, 2, 3, 4, 5, 6, 7, 8, 9 }, // input data
162 { 6.f, 12.f, 6.f, 7.5f, 15.f, 7.5f, 9.f, 18.f, 9.f }); // output expected data
166 BOOST_AUTO_TEST_SUITE_END()