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

Method Run

executor/operator/arm64/relu_float.cpp:108–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106 }
107
108 bool Run(Node* node)
109 {
110 Tensor* input_tensor = node->GetInputTensor(0);
111 Tensor* output_tensor = node->GetOutputTensor(0);
112 const TShape& shape = output_tensor->GetShape();
113 int elem_num = shape.GetSize();
114 ReLu* relu_op = dynamic_cast<ReLu*>(node->GetOp());
115 ReLuParam* param = relu_op->GetParam();
116 float* data = ( float* )get_tensor_mem(input_tensor);
117 float* out_data = ( float* )get_tensor_mem(output_tensor);
118 float negativeslope = param->negative_slope;
119
120 int cpu_number = cpu_info->GetCPUNumber();
121 int block = elem_num >> 8;
122 block = block > 0 ? block : 1;
123 int num_task = cpu_number < block ? cpu_number : block;
124 int step = elem_num / num_task;
125
126 if(num_task == 1)
127 relu_kernel( 0, 0, &step, data, out_data, negativeslope);
128 else
129 {
130 MULTI_THREAD_START(num_task, step, p_id, p_param)
131 relu_kernel(0, p_id, p_param, data, out_data, negativeslope);
132 MULTI_THREAD_END();
133 }
134 if(num_task * step != elem_num)
135 {
136 int offset = num_task * step;
137 int remain_num = elem_num - offset;
138 relu_kernel(0, 0, &remain_num, data + offset, out_data + offset, negativeslope);
139 }
140
141 return true;
142 }
143};
144
145NodeOps* SelectFunc(const CPUInfo* cpu_info, Node* node)

Callers

nothing calls this directly

Calls 8

get_tensor_memFunction · 0.85
GetOpMethod · 0.80
GetParamMethod · 0.80
GetCPUNumberMethod · 0.80
relu_kernelFunction · 0.70
GetInputTensorMethod · 0.45
GetOutputTensorMethod · 0.45
GetSizeMethod · 0.45

Tested by

no test coverage detected