Skip to content

Commit e22f789

Browse files
committed
feat(webgl): update pool2d_avg_adaptive count params
1 parent 8847e74 commit e22f789

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

packages/paddlejs-backend-webgl/src/ops/shader/pool2d_avg_adaptive.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ function mainFunc(
1818
float res = 0.0;
1919
// 获取output的坐标
2020
ivec4 out_pos = getOutputTensorPos();
21-
int count_pool = 0;
2221
int i = out_pos[2] * ${stride_v} - ${padTop};
2322
int j = out_pos[3] * ${stride_h} - ${padLeft};
2423
int hstart = int(floor(float(i) * float(${H}) / float(${ksize_y})));
@@ -29,9 +28,9 @@ function mainFunc(
2928
for (int fx = wstart; fx < wend; fx++) {
3029
float curr = getValueFromTensorPos_origin(out_pos[0], out_pos[1], fy, fx);
3130
res += curr;
32-
count_pool++;
3331
}
3432
}
33+
int count_pool = (hend - hstart) * (wend - wstart);
3534
res = res / float(count_pool);
3635
setOutput(res);
3736
}

0 commit comments

Comments
 (0)