Skip to content

Commit 6dc996f

Browse files
authored
[MLU] fix two bugs in testCase7 and testZero in test_bilinear_interp_v2_op_mlu.py (#1351)
1 parent 300e019 commit 6dc996f

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

backends/mlu/kernels/interpolate_kernel.cc

100644100755
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,10 @@ void InterpolateKernel(
165165
}
166166
}
167167

168+
if (out_h == 1 && out_w == 1) {
169+
align_center = 0;
170+
}
171+
168172
VLOG(5) << "[Interp] n: " << n << " in_d: " << in_d << " in_h: " << in_h
169173
<< " in_w: " << in_w << " out_d: " << out_d << " out_h: " << out_h
170174
<< " out_w: " << out_w << " c: " << c;
@@ -442,6 +446,10 @@ void InterpolateGradKernel(
442446
}
443447
}
444448

449+
if (out_h == 1 && out_w == 1) {
450+
align_center = 0;
451+
}
452+
445453
phi::DDim dim_grad;
446454
phi::DDim dim_out_grad, dim_out_trans_grad, dim_in_grad, dim_in_trans_grad;
447455
Tensor transformed_output_grad, transformed_input_grad;

backends/mlu/tests/unittests/test_bilinear_interp_v2_op_mlu.py

100644100755
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,9 @@ def init_test_case(self):
278278
self.align_corners = False
279279
self.align_mode = 1
280280

281+
def test_check_output(self):
282+
self.check_output_with_place(self.place, atol=1e-5)
283+
281284

282285
class TestBilinearInterpSame(TestBilinearInterpOp):
283286
def init_test_case(self):

0 commit comments

Comments
 (0)