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

Method Run

executor/operator/arm64/tanh_float.cpp:140–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138 }
139
140 bool Run(Node* node)
141 {
142 Tensor* input_tensor = node->GetInputTensor(0);
143 Tensor* output_tensor = node->GetOutputTensor(0);
144 const TShape& shape = input_tensor->GetShape();
145 int elem_num = shape.GetSize();
146 float* data = ( float* )get_tensor_mem(input_tensor);
147 float* out_data = ( float* )get_tensor_mem(output_tensor);
148
149 int cpu_number = cpu_info->GetCPUNumber();
150 int block = elem_num >> 8;
151 block = block > 0 ? block : 1;
152 int num_task = cpu_number < block ? cpu_number : block;
153 int step = elem_num / num_task;
154
155 if(num_task == 1)
156 tanh_kernel( 0, 0, &step, data, out_data);
157 else
158 {
159 MULTI_THREAD_START(num_task, step, p_id, p_param)
160 tanh_kernel(0, p_id, p_param, data, out_data);
161 MULTI_THREAD_END();
162 }
163 if(num_task * step != elem_num)
164 {
165 int offset = num_task * step;
166 int remain_num = elem_num - offset;
167 tanh_kernel(0, 0, &remain_num, data + offset, out_data + offset);
168 }
169 return true;
170 }
171};
172
173NodeOps* SelectFunc(const CPUInfo* info, Node* node)

Callers

nothing calls this directly

Calls 6

get_tensor_memFunction · 0.85
GetCPUNumberMethod · 0.80
tanh_kernelFunction · 0.70
GetInputTensorMethod · 0.45
GetOutputTensorMethod · 0.45
GetSizeMethod · 0.45

Tested by

no test coverage detected