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

Function create_test_node

internal/bin/test_eltwise_op.cpp:168–207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166}
167
168int create_test_node(graph_t graph, const char* node_name, const char* input_name, const char* input_name_1, int i_type)
169{
170 node_t test_node = create_graph_node(graph, node_name, "Eltwise");
171
172 const int type = i_type;
173 set_node_attr_int(test_node, "type", &type);
174 const float power = 1;
175 const float shift = 0;
176 const float scale = 1;
177 set_node_attr_float(test_node, "power", &power);
178 set_node_attr_float(test_node, "shift", &shift);
179 set_node_attr_float(test_node, "scale", &scale);
180
181 tensor_t input_tensor = get_graph_tensor(graph, input_name);
182 tensor_t input_tensor_1 = get_graph_tensor(graph, input_name_1);
183 int data_type = get_tensor_data_type(input_tensor);
184
185 if(input_tensor == nullptr)
186 {
187 std::cout << "ERRNO: " << get_tengine_errno() << "\n";
188 return -1;
189 }
190
191 set_node_input_tensor(test_node, 0, input_tensor);
192 set_node_input_tensor(test_node, 1, input_tensor_1);
193
194 release_graph_tensor(input_tensor);
195 release_graph_tensor(input_tensor_1);
196
197 /* output */
198 tensor_t output_tensor = create_graph_tensor(graph, node_name, data_type);
199
200 set_node_output_tensor(test_node, 0, output_tensor, TENSOR_TYPE_VAR);
201
202 release_graph_tensor(output_tensor);
203
204 release_graph_node(test_node);
205
206 return 0;
207}
208
209graph_t create_test_graph(const char* test_node_name, int c, int h, int w, int layout, int data_type, int i_type,
210 int case_num)

Callers 1

create_test_graphFunction · 0.70

Calls 11

create_graph_nodeFunction · 0.85
set_node_attr_intFunction · 0.85
set_node_attr_floatFunction · 0.85
get_graph_tensorFunction · 0.85
get_tensor_data_typeFunction · 0.85
get_tengine_errnoFunction · 0.85
set_node_input_tensorFunction · 0.85
release_graph_tensorFunction · 0.85
create_graph_tensorFunction · 0.85
set_node_output_tensorFunction · 0.85
release_graph_nodeFunction · 0.85

Tested by

no test coverage detected