提交 ab4ceee3 编写于 作者: xiebaiyuan's avatar xiebaiyuan

format code in prelu_kernel

上级 7c0bbbc5
...@@ -48,22 +48,19 @@ void PReluKernel<CPU, float>::Compute(const PReluParam &param) const { ...@@ -48,22 +48,19 @@ void PReluKernel<CPU, float>::Compute(const PReluParam &param) const {
int i = 0; int i = 0;
int temp = 0; int temp = 0;
if (mode == "channel") { if (mode == "channel") {
#pragma omp parallel for #pragma omp parallel for
for (i = 0; i < numel; i++) { for (i = 0; i < numel; i++) {
temp = numel / (dim[0] * dim[1]); temp = numel / (dim[0] * dim[1]);
index = (i / temp) % dim[1]; index = (i / temp) % dim[1];
o_ptr[i] = x_ptr[i] > 0 ? x_ptr[i] : alpha_ptr[index] * x_ptr[i]; o_ptr[i] = x_ptr[i] > 0 ? x_ptr[i] : alpha_ptr[index] * x_ptr[i];
} }
} else if (mode == "element") { } else if (mode == "element") {
#pragma omp parallel for #pragma omp parallel for
for (i = 0; i < numel; i++) { for (i = 0; i < numel; i++) {
o_ptr[i] = x_ptr[i] > 0 ? x_ptr[i] : alpha_ptr[i] * x_ptr[i]; o_ptr[i] = x_ptr[i] > 0 ? x_ptr[i] : alpha_ptr[i] * x_ptr[i];
} }
} else { } else {
#pragma omp parallel for #pragma omp parallel for
for (i = 0; i < numel; i++) { for (i = 0; i < numel; i++) {
o_ptr[i] = x_ptr[i] > 0 ? x_ptr[i] : alpha_ptr[0] * x_ptr[i]; o_ptr[i] = x_ptr[i] > 0 ? x_ptr[i] : alpha_ptr[0] * x_ptr[i];
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册