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

Function parse_node

driver/cpu/cpu_runner.cpp:266–338  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

264#ifdef ENABLE_TIME_PROFILING
265
266static void parse_node(void* data, int repeat_count, uint64_t total_time)
267{
268 const char* env = std::getenv("DEBUG");
269 Node* node = ( Node* )data;
270 NodeOps* node_ops = any_cast<NodeOps*>(node->GetAttr(ATTR_NODE_OPS));
271 Tensor* input_tensor = node->GetInputTensor(0);
272 Tensor* output_tensor = node->GetOutputTensor(0);
273 Operator* op = node->GetOp();
274 TShape& ishape = input_tensor->GetShape();
275 const std::vector<int>& in_dim = ishape.GetDim();
276 TShape& oshape = output_tensor->GetShape();
277 const std::vector<int>& out_dim = oshape.GetDim();
278 printf(" Node_idx: %4d", node->GetNodeIndex());
279 // float* outdata=(float *)get_tensor_mem(output_tensor);
280 // float* indata=(float *)get_tensor_mem(input_tensor);
281 // printf("\t%s\n",output_tensor->GetName().c_str());
282
283 printf(" %10s", op->GetName().c_str());
284 if(env && env[0] == '1')
285 printf("(%s)", node_ops->GetName().c_str());
286 printf("\t\t");
287 for(size_t i = 0; i < in_dim.size() - 1; i++)
288 {
289 printf("%dx", in_dim[i]);
290 }
291 printf("%d -> ", in_dim[in_dim.size() - 1]);
292 for(size_t i = 0; i < out_dim.size() - 1; i++)
293 {
294 printf("%dx", out_dim[i]);
295 }
296 printf("%d\t", out_dim[in_dim.size() - 1]);
297 if(op->GetName() == "Convolution" || op->GetName() == "Deconvolution")
298 {
299 Convolution* conv_op = dynamic_cast<Convolution*>(node->GetOp());
300 ConvParam* param = conv_op->GetParam();
301 printf("K: %dx%d | S: %dx%d | P: %d %d %d %d", param->kernel_h, param->kernel_w, param->stride_h, param->stride_w,
302 param->pad_h0, param->pad_h1, param->pad_w0, param->pad_w1);
303 if(param->group != 1)
304 {
305 printf(" DW(%2d)", param->group);
306 }
307 else
308 {
309 printf(" ");
310 }
311 }
312 else if(op->GetName() == "Pooling")
313 {
314 Pooling* conv_op = dynamic_cast<Pooling*>(node->GetOp());
315 PoolParam* param = conv_op->GetParam();
316 printf("K: %dx%d | S: %dx%d | P: %d %d %d %d", param->kernel_h, param->kernel_w, param->stride_h, param->stride_w,
317 param->pad_h0, param->pad_h1, param->pad_w0, param->pad_w1);
318 if(param->alg == 0)
319 {
320 printf(" Max");
321 }
322 else
323 {

Callers

nothing calls this directly

Calls 10

GetOpMethod · 0.80
GetNodeIndexMethod · 0.80
GetNameMethod · 0.80
GetParamMethod · 0.80
GetAttrMethod · 0.45
GetInputTensorMethod · 0.45
GetOutputTensorMethod · 0.45
c_strMethod · 0.45
sizeMethod · 0.45
GetFopsMethod · 0.45

Tested by

no test coverage detected