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

Function dump_output_data

internal/bin/test_transpose.cpp:200–227  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

198}
199
200void dump_output_data(node_t test_node)
201{
202 tensor_t output_tensor = get_node_output_tensor(test_node, 0);
203 int dims[4];
204
205 get_tensor_shape(output_tensor, dims, 4);
206
207 void* o_buf = get_tensor_buffer(output_tensor);
208 int data_type = get_tensor_data_type(output_tensor);
209 float scale = 0.1f;
210 int zero = 0;
211 if(data_type == TENGINE_DT_INT8 || data_type == TENGINE_DT_UINT8)
212 {
213 get_tensor_quant_param(output_tensor, &scale, &zero, 1);
214 printf("output scale: %f ,zero: %d\n", scale, zero);
215 }
216
217 for(int i = 0; i < dims[1] * dims[0] * dims[2] * dims[3]; i++)
218 {
219 if(data_type == TENGINE_DT_FP32)
220 {
221 float* p = ( float* )o_buf;
222 std::cout << i << " " << p[i] << "\n";
223 }
224 }
225
226 release_graph_tensor(output_tensor);
227}
228
229int main(int argc, char* argv[])
230{

Callers 1

mainFunction · 0.70

Calls 6

get_node_output_tensorFunction · 0.85
get_tensor_shapeFunction · 0.85
get_tensor_bufferFunction · 0.85
get_tensor_data_typeFunction · 0.85
get_tensor_quant_paramFunction · 0.85
release_graph_tensorFunction · 0.85

Tested by

no test coverage detected