未验证 提交 1cd700d8 编写于 作者: Q qingqing01 提交者: GitHub

Fix bug in LRN operator. (#9124)

上级 b5a16dca
......@@ -36,7 +36,7 @@ struct LRNFunctor<platform::CPUDeviceContext, T> {
auto e_x = framework::EigenTensor<T, 4>::From(input);
for (int m = 0; m < N; m++) {
for (int i = 0; i < C; i++) {
for (int c = start; c <= end; c++) {
for (int c = start; c < end; c++) {
int ch = i + c;
if (ch >= 0 && ch < C) {
auto s = e_mid.slice(Eigen::array<int, 4>({{m, i, 0, 0}}),
......@@ -92,7 +92,7 @@ struct LRNGradFunctor<platform::CPUDeviceContext, T> {
Eigen::array<int, 4>({{1, 1, H, W}}));
i_x_g = i_mid.pow(-beta) * i_out_g;
for (int c = start; c <= end; c++) {
for (int c = start; c < end; c++) {
int ch = i + c;
if (ch < 0 || ch >= C) {
continue;
......
......@@ -41,7 +41,7 @@ class TestLRNOp(OpTest):
mid.fill(self.k)
for m in range(0, self.N):
for i in range(0, self.C):
for c in range(start, end + 1):
for c in range(start, end):
ch = i + c
if ch < 0 or ch >= self.C:
continue
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册