diff --git a/paddle/fluid/operators/interpolate_op.cu b/paddle/fluid/operators/interpolate_op.cu index 35177a4e9ade26831f50de84bbb943d856cb98d9..cbffc2fa630fa17f5567e8dc4140787c83c77ed0 100644 --- a/paddle/fluid/operators/interpolate_op.cu +++ b/paddle/fluid/operators/interpolate_op.cu @@ -286,7 +286,7 @@ class InterpolateGradOpCUDAKernel : public framework::OpKernel { float scale = ctx.Attr("scale"); if (scale > 0) { out_h = in_h * scale; - out_w - in_w* scale; + out_w = in_w * scale; } auto out_size = ctx.Input("OutSize"); if (out_size != nullptr) { diff --git a/python/paddle/fluid/tests/unittests/test_bilinear_interp_op.py b/python/paddle/fluid/tests/unittests/test_bilinear_interp_op.py index 963a17e7d697512e871a97ef24cb1c4ba37a7547..e06c87d969f4c1146f1636a6402059f82341cff3 100644 --- a/python/paddle/fluid/tests/unittests/test_bilinear_interp_op.py +++ b/python/paddle/fluid/tests/unittests/test_bilinear_interp_op.py @@ -305,7 +305,7 @@ class TestBilinearInterpWithMethod3(TestBilinearInterpOp): class TestBilinearInterpScale1(TestBilinearInterpOp): def init_test_case(self): self.interp_method = 'bilinear' - self.input_shape = [2, 3, 16, 32] + self.input_shape = [2, 3, 5, 7] self.out_h = 60 self.out_w = 25 self.scale = 2. @@ -316,7 +316,7 @@ class TestBilinearInterpScale1(TestBilinearInterpOp): class TestBilinearInterpScale2(TestBilinearInterpOp): def init_test_case(self): self.interp_method = 'bilinear' - self.input_shape = [2, 3, 16, 32] + self.input_shape = [2, 3, 5, 7] self.out_h = 60 self.out_w = 25 self.scale = 1. @@ -327,7 +327,7 @@ class TestBilinearInterpScale2(TestBilinearInterpOp): class TestBilinearInterpScale3(TestBilinearInterpOp): def init_test_case(self): self.interp_method = 'bilinear' - self.input_shape = [2, 3, 16, 32] + self.input_shape = [2, 3, 5, 7] self.out_h = 60 self.out_w = 25 self.scale = 1.5 diff --git a/python/paddle/fluid/tests/unittests/test_nearest_interp_op.py b/python/paddle/fluid/tests/unittests/test_nearest_interp_op.py index eb82af75e4a2bf834c010aede79d50b0d73c98bc..1feb2aefda4d18255db13f657a79f0bd05d1b0a3 100644 --- a/python/paddle/fluid/tests/unittests/test_nearest_interp_op.py +++ b/python/paddle/fluid/tests/unittests/test_nearest_interp_op.py @@ -259,7 +259,7 @@ class TestNearestInterpWithoutCorners(TestNearestInterpOp): class TestNearestNeighborInterpScale1(TestNearestInterpOp): def init_test_case(self): self.interp_method = 'nearest' - self.input_shape = [3, 2, 32, 16] + self.input_shape = [3, 2, 7, 5] self.out_h = 64 self.out_w = 32 self.scale = 2. @@ -270,7 +270,7 @@ class TestNearestNeighborInterpScale1(TestNearestInterpOp): class TestNearestNeighborInterpScale2(TestNearestInterpOp): def init_test_case(self): self.interp_method = 'nearest' - self.input_shape = [3, 2, 32, 16] + self.input_shape = [3, 2, 5, 7] self.out_h = 64 self.out_w = 32 self.scale = 1.5 @@ -281,7 +281,7 @@ class TestNearestNeighborInterpScale2(TestNearestInterpOp): class TestNearestNeighborInterpScale3(TestNearestInterpOp): def init_test_case(self): self.interp_method = 'nearest' - self.input_shape = [3, 2, 32, 16] + self.input_shape = [3, 2, 7, 5] self.out_h = 64 self.out_w = 32 self.scale = 1.