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

Function dump_output_data

internal/bin/test_mini_op.cpp:211–252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

209}
210
211void dump_output_data(node_t test_node)
212{
213 tensor_t output_tensor = get_node_output_tensor(test_node, 0);
214 int dims[4];
215
216 get_tensor_shape(output_tensor, dims, 4);
217
218 void* o_buf = get_tensor_buffer(output_tensor);
219 int data_type = get_tensor_data_type(output_tensor);
220
221 for(int i = 0; i < dims[0] * dims[1]; i++)
222 {
223 if(data_type == TENGINE_DT_FP32)
224 {
225 float* p = ( float* )o_buf;
226 std::cout << i << " " << p[i] << "\n";
227 }
228 else if(data_type == TENGINE_DT_FP16)
229 {
230 __fp16* p = ( __fp16* )o_buf;
231
232#ifdef __ARM_ARCH
233 std::cout << i << " " << ( float )p[i] << "\n";
234#else
235 std::cout << i << " " << fp16_to_fp32(p[i]) << "\n";
236#endif
237 }
238 else if(data_type == TENGINE_DT_INT8)
239 {
240 int8_t* p = ( int8_t* )o_buf;
241 std::cout << i << " " << ( int )p[i] << "\n";
242 }
243 else
244 {
245 uint8_t* p = ( uint8_t* )o_buf;
246
247 std::cout << i << " " << ( int )p[i] << "\n";
248 }
249 }
250
251 release_graph_tensor(output_tensor);
252}
253
254int main(int argc, char* argv[])
255{

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
fp16_to_fp32Function · 0.85
release_graph_tensorFunction · 0.85

Tested by

no test coverage detected