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

Method Run

executor/operator/arm32/selu_float.cpp:90–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Tested by

no test coverage detected