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

Method Run

executor/operator/arm32/elu_float.cpp:84–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82 }
83
84 bool Run(Node* node)
85 {
86 Tensor* input_tensor = node->GetInputTensor(0);
87 Tensor* output_tensor = node->GetOutputTensor(0);
88 Elu* Elu_op = dynamic_cast<Elu*>(node->GetOp());
89 EluParam* param_ = Elu_op->GetParam();
90 float alpha = param_->alpha;
91
92 int elem_num = input_tensor->GetShape().GetSize();
93
94 float* data = ( float* )get_tensor_mem(input_tensor);
95 float* out_data = ( float* )get_tensor_mem(output_tensor);
96
97 int cpu_number = cpu_info->GetCPUNumber();
98 int block = elem_num >> 8;
99 block = block > 0 ? block : 1;
100 int num_task = cpu_number < block ? cpu_number : block;
101 int step = elem_num / num_task;
102
103 if(num_task == 1)
104 elu_kernel( 0, 0, &step, data, out_data, alpha);
105 else
106 {
107 MULTI_THREAD_START(num_task, step, p_id, p_param)
108 elu_kernel(0, p_id, p_param, data, out_data, alpha);
109 MULTI_THREAD_END();
110 }
111 if(num_task * step != elem_num)
112 {
113 int offset = num_task * step;
114 int remain_num = elem_num - offset;
115 elu_kernel(0, 0, &remain_num, data + offset, out_data + offset, alpha);
116 }
117
118 return true;
119
120 }
121};
122
123NodeOps* 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
elu_kernelFunction · 0.70
GetInputTensorMethod · 0.45
GetOutputTensorMethod · 0.45
GetSizeMethod · 0.45

Tested by

no test coverage detected