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

Function create_test_node

internal/bin/test_concat_op.cpp:88–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86}
87
88int create_test_node(graph_t graph, const char* node_name, int axis, const char* inputs[], int input_counts)
89{
90 std::cout << "create_ggraph_node--" << axis << "\n";
91 node_t test_node = create_graph_node(graph, node_name, "Concat");
92 if(test_node == nullptr)
93 {
94 std::cout << "create_graph_node_failed : node_name=" << node_name << "\n";
95 return -1;
96 }
97
98 int data_type = 0;
99 int dim[4] = {0};
100 int concat_dim = 0;
101 for(int ii = 0; ii < input_counts; ++ii)
102 {
103 tensor_t input_tensor = get_graph_tensor(graph, inputs[ii]);
104 data_type = get_tensor_data_type(input_tensor);
105
106 get_tensor_shape(input_tensor, dim, 4);
107 concat_dim += dim[axis];
108
109 if(input_tensor == nullptr)
110 {
111 std::cout << "ERRNO: " << get_tengine_errno() << "\noutput";
112 return -1;
113 }
114 // std::cout << "set_node_input_tensor\n";
115 set_node_input_tensor(test_node, ii, input_tensor);
116 // std::cout << "release_input_tensor\n";
117 release_graph_tensor(input_tensor);
118 }
119
120 dim[axis] = concat_dim;
121 std::cout << "output_dim: " << dim[0] << "-" << dim[1] << "-" << dim[2] << "-" << dim[3] << "\n";
122 /* output */
123 tensor_t output_tensor = create_graph_tensor(graph, node_name, data_type);
124 set_tensor_shape(output_tensor, dim, 4);
125 set_node_output_tensor(test_node, 0, output_tensor, TENSOR_TYPE_VAR);
126
127 if(data_type == TENGINE_DT_UINT8)
128 {
129 set_tensor_quant_param(output_tensor, &uint8_scale, &uint8_zero, 1);
130 }
131
132 release_graph_tensor(output_tensor);
133
134 set_node_attr_int(test_node, "axis", &axis);
135 release_graph_node(test_node);
136
137 return 0;
138}
139
140graph_t create_test_graph(const char* test_node_name, int axis, const std::vector<ConcatInputParam>& inputParam,
141 int layout, int data_type)

Callers 1

create_test_graphFunction · 0.70

Calls 13

create_graph_nodeFunction · 0.85
get_graph_tensorFunction · 0.85
get_tensor_data_typeFunction · 0.85
get_tensor_shapeFunction · 0.85
get_tengine_errnoFunction · 0.85
set_node_input_tensorFunction · 0.85
release_graph_tensorFunction · 0.85
create_graph_tensorFunction · 0.85
set_tensor_shapeFunction · 0.85
set_node_output_tensorFunction · 0.85
set_tensor_quant_paramFunction · 0.85
set_node_attr_intFunction · 0.85

Tested by

no test coverage detected