ArmNN
 21.08
Const.cpp File Reference

Go to the source code of this file.

Functions

 TEST_SUITE ("OnnxParser_Const")
 

Function Documentation

◆ TEST_SUITE()

TEST_SUITE ( "OnnxParser_Const"  )

Definition at line 9 of file Const.cpp.

References TEST_CASE_FIXTURE().

10 {
11 struct ConstMainFixture : public armnnUtils::ParserPrototxtFixture<armnnOnnxParser::IOnnxParser>
12 {
13  ConstMainFixture(const std::string& dataType)
14  {
15  m_Prototext = R"(
16  ir_version: 3
17  producer_name: "CNTK "
18  producer_version: "2.5.1 "
19  domain: "ai.cntk "
20  model_version: 1
21  graph {
22  name: "CNTKGraph "
23  node {
24  output: "Output"
25  attribute {
26  name: "value"
27  t {
28  dims: 7
29  data_type: )" + dataType + R"(
30  float_data: 0.0
31  float_data: 1.0
32  float_data: 2.0
33  float_data: 3.0
34  float_data: 4.0
35  float_data: 5.0
36  float_data: 6.0
37 
38  }
39  type: 1
40  }
41  name: "constantNode"
42  op_type: "Constant"
43  }
44  output {
45  name: "Output"
46  type {
47  tensor_type {
48  elem_type: 1
49  shape {
50  dim {
51  dim_value: 7
52  }
53  }
54  }
55  }
56  }
57  }
58  opset_import {
59  version: 7
60  })";
61  }
62 };
63 
64 struct ConstValidFixture : ConstMainFixture
65 {
66  ConstValidFixture() : ConstMainFixture("1") {
67  Setup();
68  }
69 };
70 
71 struct ConstInvalidFixture : ConstMainFixture
72 {
73  ConstInvalidFixture() : ConstMainFixture("10") { }
74 };
75 
76 TEST_CASE_FIXTURE(ConstValidFixture, "ValidConstTest")
77 {
78  RunTest<1>({ }, {{ "Output" , {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0}}});
79 }
80 
81 TEST_CASE_FIXTURE(ConstInvalidFixture, "IncorrectDataTypeConst")
82 {
83  CHECK_THROWS_AS( Setup(), armnn::ParseException);
84 }
85 
86 }
TEST_CASE_FIXTURE(ClContextControlFixture, "CopyBetweenNeonAndGpu")