ArmNN
 20.02
Convolution2d.cpp File Reference
#include <boost/test/unit_test.hpp>
#include "armnnTfParser/ITfParser.hpp"
#include "ParserPrototxtFixture.hpp"
#include <array>
#include <string>
#include <iostream>

Go to the source code of this file.

Functions

 BOOST_FIXTURE_TEST_CASE (ParseConv2dNhwcSame, Convolution2dNhwcSameFixture)
 
 BOOST_FIXTURE_TEST_CASE (ParseConv2dNchwSame, Convolution2dNchwSameFixture)
 
 BOOST_FIXTURE_TEST_CASE (ParseConv2dNhwcValid, Convolution2dNhwcValidFixture)
 
 BOOST_FIXTURE_TEST_CASE (ParseConv2dNchwValid, Convolution2dNchwValidFixture)
 
 BOOST_FIXTURE_TEST_CASE (ParseConv2dStride2NhwcSame, Convolution2dStride2NhwcSameFixture)
 
 BOOST_FIXTURE_TEST_CASE (ParseConv2dStride2NchwSame, Convolution2dStride2NchwSameFixture)
 
 BOOST_FIXTURE_TEST_CASE (ParseConv2dStride2NhwcValid, Convolution2dStride2NhwcValidFixture)
 
 BOOST_FIXTURE_TEST_CASE (ParseConv2dStride2NchwValid, Convolution2dStride2NchwValidFixture)
 
 BOOST_FIXTURE_TEST_CASE (ParseConv2dDilation1Nhwc, Convolution2dDilation1NhwcFixture)
 
 BOOST_FIXTURE_TEST_CASE (ParseConv2dDilation1Nchw, Convolution2dDilation1NchwFixture)
 
 BOOST_AUTO_TEST_CASE (ParseConv2dDilation2)
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE()

BOOST_AUTO_TEST_CASE ( ParseConv2dDilation2  )

Definition at line 266 of file Convolution2d.cpp.

References BOOST_AUTO_TEST_SUITE_END(), and ITfParser::Create().

267 {
268  const char* prototext = ""
269  "node {\n"
270  " name: \"graphInput\"\n"
271  " op: \"Placeholder\"\n"
272  " attr {\n"
273  " key: \"dtype\"\n"
274  " value {\n"
275  " type: DT_FLOAT\n"
276  " }\n"
277  " }\n"
278  " attr {\n"
279  " key: \"shape\"\n"
280  " value {\n"
281  " shape {\n"
282  " }\n"
283  " }\n"
284  " }\n"
285  "}\n"
286  "node {\n"
287  " name: \"Const_1\"\n"
288  " op: \"Const\"\n"
289  " attr {\n"
290  " key: \"dtype\"\n"
291  " value {\n"
292  " type: DT_FLOAT\n"
293  " }\n"
294  " }\n"
295  " attr {\n"
296  " key: \"value\"\n"
297  " value {\n"
298  " tensor {\n"
299  " dtype: DT_FLOAT\n"
300  " tensor_shape {\n"
301  " dim {\n"
302  " size: 1\n"
303  " }\n"
304  " dim {\n"
305  " size: 3\n"
306  " }\n"
307  " dim {\n"
308  " size: 1\n"
309  " }\n"
310  " dim {\n"
311  " size: 1\n"
312  " }\n"
313  " }\n"
314  " tensor_content: \"\\000\\000\\000?\\000\\000\\200?\\000\\000\\000?\"\n"
315  " }\n"
316  " }\n"
317  " }\n"
318  "}\n"
319  "node {\n"
320  " name: \"potato\"\n"
321  " op: \"Conv2D\"\n"
322  " input: \"graphInput\"\n"
323  " input: \"Const_1\"\n"
324  " attr {\n"
325  " key: \"T\"\n"
326  " value {\n"
327  " type: DT_FLOAT\n"
328  " }\n"
329  " }\n"
330  " attr {\n"
331  " key: \"data_format\"\n"
332  " value {\n"
333  " s: \"NHWC\"\n"
334  " }\n"
335  " }\n"
336  " attr {\n"
337  " key: \"padding\"\n"
338  " value {\n"
339  " s: \"SAME\"\n"
340  " }\n"
341  " }\n"
342  " attr {\n"
343  " key: \"strides\"\n"
344  " value {\n"
345  " list {\n"
346  " i: 1\n"
347  " i: 1\n"
348  " i: 1\n"
349  " i: 1\n"
350  " }\n"
351  " }\n"
352  " }\n"
353  " attr {\n"
354  " key: \"dilations\"\n"
355  " value {\n"
356  " list {\n"
357  " i: 1\n"
358  " i: 2\n"
359  " i: 2\n"
360  " i: 1\n"
361  " }\n"
362  " }\n"
363  " }\n"
364  " attr {\n"
365  " key: \"use_cudnn_on_gpu\"\n"
366  " value {\n"
367  " b: false\n"
368  " }\n"
369  " }\n"
370  "}\n";
371 
372  std::map<std::string, armnn::TensorShape> inputShapes;
373  armnn::TensorShape tensorShape = { 1, 3, 3, 1 };
374  inputShapes["graphInput"] = tensorShape;
376  BOOST_CHECK_THROW(parser->CreateNetworkFromString(prototext, inputShapes, { "potato" }), armnn::ParseException);
377 }
std::unique_ptr< ITfParser, void(*)(ITfParser *parser)> ITfParserPtr
Definition: ITfParser.hpp:22
static ITfParserPtr Create()
Definition: TfParser.cpp:395

◆ BOOST_FIXTURE_TEST_CASE() [1/10]

BOOST_FIXTURE_TEST_CASE ( ParseConv2dNhwcSame  ,
Convolution2dNhwcSameFixture   
)

Definition at line 175 of file Convolution2d.cpp.

176 {
177  RunTest<4>({1, 2, 3, 4, 5, 6}, {2, 4, 4, 6.5f, 10 , 8.5f});
178 }

◆ BOOST_FIXTURE_TEST_CASE() [2/10]

BOOST_FIXTURE_TEST_CASE ( ParseConv2dNchwSame  ,
Convolution2dNchwSameFixture   
)

Definition at line 184 of file Convolution2d.cpp.

185 {
186  RunTest<4>({1, 2, 3, 4, 5, 6}, {2, 4, 4, 6.5f, 10 , 8.5f});
187 }

◆ BOOST_FIXTURE_TEST_CASE() [3/10]

BOOST_FIXTURE_TEST_CASE ( ParseConv2dNhwcValid  ,
Convolution2dNhwcValidFixture   
)

Definition at line 194 of file Convolution2d.cpp.

195 {
196  RunTest<4>({1, 2, 3, 4, 5, 6}, {4, 10});
197 }

◆ BOOST_FIXTURE_TEST_CASE() [4/10]

BOOST_FIXTURE_TEST_CASE ( ParseConv2dNchwValid  ,
Convolution2dNchwValidFixture   
)

Definition at line 203 of file Convolution2d.cpp.

204 {
205  RunTest<4>({1, 2, 3, 4, 5, 6}, {4, 10});
206 }

◆ BOOST_FIXTURE_TEST_CASE() [5/10]

BOOST_FIXTURE_TEST_CASE ( ParseConv2dStride2NhwcSame  ,
Convolution2dStride2NhwcSameFixture   
)

Definition at line 213 of file Convolution2d.cpp.

214 {
215  RunTest<4>({1, 2, 3, 4, 5, 6, 7, 8, 9}, {2, 4, 6.5, 8.5, 11, 13});
216 }

◆ BOOST_FIXTURE_TEST_CASE() [6/10]

BOOST_FIXTURE_TEST_CASE ( ParseConv2dStride2NchwSame  ,
Convolution2dStride2NchwSameFixture   
)

Definition at line 222 of file Convolution2d.cpp.

223 {
224  RunTest<4>({1, 2, 3, 4, 5, 6, 7, 8, 9}, {2, 4, 6.5, 8.5, 11, 13});
225 }

◆ BOOST_FIXTURE_TEST_CASE() [7/10]

BOOST_FIXTURE_TEST_CASE ( ParseConv2dStride2NhwcValid  ,
Convolution2dStride2NhwcValidFixture   
)

Definition at line 232 of file Convolution2d.cpp.

233 {
234  RunTest<4>({1, 2, 3, 4, 5, 6, 7, 8, 9}, {4, 10, 16});
235 }

◆ BOOST_FIXTURE_TEST_CASE() [8/10]

BOOST_FIXTURE_TEST_CASE ( ParseConv2dStride2NchwValid  ,
Convolution2dStride2NchwValidFixture   
)

Definition at line 241 of file Convolution2d.cpp.

242 {
243  RunTest<4>({1, 2, 3, 4, 5, 6, 7, 8, 9}, {4, 10, 16});
244 }

◆ BOOST_FIXTURE_TEST_CASE() [9/10]

BOOST_FIXTURE_TEST_CASE ( ParseConv2dDilation1Nhwc  ,
Convolution2dDilation1NhwcFixture   
)

Definition at line 251 of file Convolution2d.cpp.

252 {
253  RunTest<4>({1, 2, 3, 4, 5, 6}, {2, 4, 4, 6.5f, 10 , 8.5f});
254 }

◆ BOOST_FIXTURE_TEST_CASE() [10/10]

BOOST_FIXTURE_TEST_CASE ( ParseConv2dDilation1Nchw  ,
Convolution2dDilation1NchwFixture   
)

Definition at line 260 of file Convolution2d.cpp.

261 {
262  RunTest<4>({1, 2, 3, 4, 5, 6}, {2, 4, 4, 6.5f, 10 , 8.5f});
263 }