From 10c487eb214ce0ab0a6b90516cc251f71050b347 Mon Sep 17 00:00:00 2001 From: Kaipeng Deng Date: Fri, 26 Apr 2019 10:09:34 +0800 Subject: [PATCH] fix interpolate cu. test=develop (#17101) --- paddle/fluid/operators/interpolate_op.cu | 2 +- .../paddle/fluid/tests/unittests/test_bilinear_interp_op.py | 6 +++--- .../paddle/fluid/tests/unittests/test_nearest_interp_op.py | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/paddle/fluid/operators/interpolate_op.cu b/paddle/fluid/operators/interpolate_op.cu index 35177a4e9ad..cbffc2fa630 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 963a17e7d69..e06c87d969f 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 eb82af75e4a..1feb2aefda4 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. -- GitLab