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

Function create_test_graph

internal/bin/test_elu.cpp:114–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

test_opFunction · 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