MCPcopy Create free account
hub / github.com/OAID/Tengine / create_test_graph

Function create_test_graph

internal/bin/test_softmax.cpp:118–165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

116}
117
118graph_t create_test_graph(const char* test_node_name, int c, int h, int w, int layout, int data_type, int negative_slope)
119{
120 graph_t graph = create_graph(nullptr, nullptr, nullptr);
121
122 if(graph == nullptr)
123 {
124 std::cerr << "create failed: ERRNO: " << get_tengine_errno() << "\n";
125 return nullptr;
126 }
127
128 if(set_graph_layout(graph, layout) < 0)
129 {
130 std::cerr << "set layout failed: ERRNO: " << get_tengine_errno() << "\n";
131 return nullptr;
132 }
133
134 const char* input_name = "data";
135
136 if(create_input_node(graph, input_name, c, h, w, data_type) < 0)
137 {
138 std::cerr << "create input failed\n";
139 return nullptr;
140 }
141
142 if(create_test_node(graph, test_node_name, input_name, negative_slope) < 0)
143 {
144 std::cerr << "create test node failed\n";
145 return nullptr;
146 }
147
148 /* set input/output node */
149 const char* inputs[] = {input_name};
150 const char* outputs[] = {test_node_name};
151
152 if(set_graph_input_node(graph, inputs, sizeof(inputs) / sizeof(char*)) < 0)
153 {
154 std::cerr << "set inputs failed: ERRNO: " << get_tengine_errno() << "\n";
155 return nullptr;
156 }
157
158 if(set_graph_output_node(graph, outputs, sizeof(outputs) / sizeof(char*)) < 0)
159 {
160 std::cerr << "set outputs failed: ERRNO: " << get_tengine_errno() << "\n";
161 return nullptr;
162 }
163
164 return graph;
165}
166
167
168

Callers 1

mainFunction · 0.70

Calls 7

create_graphFunction · 0.85
get_tengine_errnoFunction · 0.85
set_graph_layoutFunction · 0.85
set_graph_input_nodeFunction · 0.85
set_graph_output_nodeFunction · 0.85
create_input_nodeFunction · 0.70
create_test_nodeFunction · 0.70

Tested by

no test coverage detected