ArmNN
 20.05
Reshape.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #include <boost/test/unit_test.hpp>
9 
10 BOOST_AUTO_TEST_SUITE(TensorflowParser)
11 
12 struct ReshapeFixture : public armnnUtils::ParserPrototxtFixture<armnnTfParser::ITfParser>
13 {
14  ReshapeFixture()
15  {
16  m_Prototext = "node { \n"
17  " name: \"graphInput\" \n"
18  " op: \"Placeholder\" \n"
19  " attr { \n"
20  " key: \"dtype\" \n"
21  " value { \n"
22  " type: DT_FLOAT \n"
23  " } \n"
24  " } \n"
25  " attr { \n"
26  " key: \"shape\" \n"
27  " value { \n"
28  " shape { \n"
29  " } \n"
30  " } \n"
31  " } \n"
32  " } \n"
33  "node { \n"
34  " name: \"Reshape/shape\" \n"
35  " op: \"Const\" \n"
36  " attr { \n"
37  " key: \"dtype\" \n"
38  " value { \n"
39  " type: DT_INT32 \n"
40  " } \n"
41  " } \n"
42  " attr { \n"
43  " key: \"value\" \n"
44  " value { \n"
45  " tensor { \n"
46  " dtype: DT_INT32 \n"
47  " tensor_shape { \n"
48  " dim { \n"
49  " size: 2 \n"
50  " } \n"
51  " } \n"
52  " tensor_content: \"\\002\\000\\000\\000\\002\\000\\000\\000\" \n"
53  " } \n"
54  " } \n"
55  " } \n"
56  "} \n"
57  "node { \n"
58  " name: \"Reshape\" \n"
59  " op: \"Reshape\" \n"
60  " input: \"graphInput\" \n"
61  " input: \"Reshape/shape\" \n"
62  " attr { \n"
63  " key: \"T\" \n"
64  " value { \n"
65  " type: DT_FLOAT \n"
66  " } \n"
67  " } \n"
68  " attr { \n"
69  " key: \"Tshape\" \n"
70  " value { \n"
71  " type: DT_INT32 \n"
72  " } \n"
73  " } \n"
74  "} \n";
75 
76  SetupSingleInputSingleOutput({1, 4}, "graphInput", "Reshape");
77  }
78 };
79 
80 BOOST_FIXTURE_TEST_CASE(ParseReshape, ReshapeFixture)
81 {
82  RunTest<2>({ 0.0f, 1.0f, 2.0f, 3.0f }, { 0.0f, 1.0f, 2.0f, 3.0f });
83 }
84 
BOOST_AUTO_TEST_SUITE(TensorflowLiteParser)
BOOST_FIXTURE_TEST_CASE(ValidReshapeTest, ReshapeValidFixture)
Definition: Reshape.cpp:192
BOOST_AUTO_TEST_SUITE_END()
void SetupSingleInputSingleOutput(const std::string &inputName, const std::string &outputName)
Parses and loads the network defined by the m_Prototext string.