未验证 提交 362ac42f 编写于 作者: T Tao Luo 提交者: GitHub

Merge pull request #13134 from tensor-tang/refine/op/prelu

refine prelu
...@@ -38,10 +38,9 @@ class PReluKernel : public framework::OpKernel<T> { ...@@ -38,10 +38,9 @@ class PReluKernel : public framework::OpKernel<T> {
auto dim = x->dims(); auto dim = x->dims();
int index = 0; int index = 0;
int i = 0; int i = 0;
int temp = 0;
if (mode == "channel") { if (mode == "channel") {
int temp = numel / (dim[0] * dim[1]);
for (i = 0; i < numel; i++) { for (i = 0; i < numel; i++) {
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];
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册