ArmNN
 22.05
CreateNetwork.cpp File Reference
#include "armnnOnnxParser/IOnnxParser.hpp"
#include <doctest/doctest.h>
#include "google/protobuf/stubs/logging.h"

Go to the source code of this file.

Functions

 TEST_SUITE ("OnnxParser_CreateNetwork")
 

Function Documentation

◆ TEST_SUITE()

TEST_SUITE ( "OnnxParser_CreateNetwork"  )

Definition at line 11 of file CreateNetwork.cpp.

References IOnnxParser::Create().

12 {
13 TEST_CASE("CreateNetworkFromString")
14 {
15  std::string TestModel = 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  output {
24  name: "Output"
25  type {
26  tensor_type {
27  elem_type: 1
28  shape {
29  dim {
30  dim_value: 1
31  }
32  dim {
33  dim_value: 10
34  }
35  }
36  }
37  }
38  }
39  }
40  opset_import {
41  version: 7
42  })";
43 
45 
46  armnn::INetworkPtr network = parser->CreateNetworkFromString(TestModel.c_str());
47  CHECK(network.get());
48 }
49 
50 TEST_CASE("CreateNetworkFromStringWithNullptr")
51 {
53  CHECK_THROWS_AS(parser->CreateNetworkFromString(""), armnn::InvalidArgumentException );
54 }
55 
56 TEST_CASE("CreateNetworkWithInvalidString")
57 {
58  auto silencer = google::protobuf::LogSilencer(); //get rid of errors from protobuf
60  CHECK_THROWS_AS(parser->CreateNetworkFromString( "I'm not a model so I should raise an error" ),
62 }
63 
64 }
static IOnnxParserPtr Create()
Definition: OnnxParser.cpp:38
std::unique_ptr< INetwork, void(*)(INetwork *network)> INetworkPtr
Definition: INetwork.hpp:241
std::unique_ptr< IOnnxParser, void(*)(IOnnxParser *parser)> IOnnxParserPtr
Definition: IOnnxParser.hpp:21