diff --git a/paddle/fluid/operators/squeeze_op.cc b/paddle/fluid/operators/squeeze_op.cc index 639480aba41783a5e830270733e175f502087b8f..29648cdd95115c4a25b09af85679671b6dafba38 100644 --- a/paddle/fluid/operators/squeeze_op.cc +++ b/paddle/fluid/operators/squeeze_op.cc @@ -33,10 +33,10 @@ class SqueezeOp : public framework::OperatorWithKernel { "Output(Out) of SqueezeOp should not be null."); const auto& x_dims = ctx->GetInputDim("X"); - // Check input tensor dims (<9). - PADDLE_ENFORCE(x_dims.size() <= 9, + // Check input tensor dims (<6) Eigen limit. + PADDLE_ENFORCE(x_dims.size() <= 6, "Invalid dimnesions, dynamic dimensions must have " - "between [1, 9] dimensions."); + "between [1, 6] dimensions (Eigen limit)."); const auto& axes = ctx->Attrs().Get>("axes"); for (int a : axes) { diff --git a/paddle/fluid/operators/squeeze_op.cu b/paddle/fluid/operators/squeeze_op.cu index 1096907daa5dfca4f12d0d8de6ff6fdca16ca6dd..27525745029e5d766ae8635500a8c8fc2c799910 100644 --- a/paddle/fluid/operators/squeeze_op.cu +++ b/paddle/fluid/operators/squeeze_op.cu @@ -12,8 +12,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -#define EIGEN_USE_GPU - #include "paddle/fluid/operators/squeeze_op.h" namespace ops = paddle::operators; diff --git a/python/paddle/fluid/tests/unittests/test_squeeze_op.py b/python/paddle/fluid/tests/unittests/test_squeeze_op.py index 58c87ea3c16a8a0d88814093667eb4129af4d968..6ef5204b72f0ae8a161ce206ae9ae51610267a72 100644 --- a/python/paddle/fluid/tests/unittests/test_squeeze_op.py +++ b/python/paddle/fluid/tests/unittests/test_squeeze_op.py @@ -27,7 +27,7 @@ class TestSqueezeOp1(OpTest): self.op_type = "squeeze" self.inputs = {"X": np.random.random(ori_shape).astype("float32")} - self.attrs = {"axes": axes, "inpalce": False} + self.attrs = {"axes": axes, "inplace": False} self.outputs = {"Out": self.inputs["X"].reshape(new_shape)} def test_check_output(self): @@ -46,7 +46,7 @@ class TestSqueezeOp2(OpTest): self.op_type = "squeeze" self.inputs = {"X": np.random.random(ori_shape).astype("float32")} - self.attrs = {"axes": axes, "inpalce": False} + self.attrs = {"axes": axes, "inplace": False} self.outputs = {"Out": self.inputs["X"].reshape(new_shape)} def test_check_output(self): @@ -65,7 +65,7 @@ class TestSqueezeOp3(OpTest): self.op_type = "squeeze" self.inputs = {"X": np.random.random(ori_shape).astype("float32")} - self.attrs = {"axes": axes, "inpalce": False} + self.attrs = {"axes": axes, "inplace": False} self.outputs = {"Out": self.inputs["X"].reshape(new_shape)} def test_check_output(self): @@ -78,13 +78,13 @@ class TestSqueezeOp3(OpTest): # Correct: Just part of axes be squeezed. class TestSqueezeOp4(OpTest): def setUp(self): - ori_shape = (1, 3, 1, 5, 1, 4, 1) - axes = (2, 6) - new_shape = (1, 3, 5, 1, 4) + ori_shape = (3, 1, 5, 1, 4, 1) + axes = (1, -1) + new_shape = (3, 5, 1, 4) self.op_type = "squeeze" self.inputs = {"X": np.random.random(ori_shape).astype("float32")} - self.attrs = {"axes": axes, "inpalce": False} + self.attrs = {"axes": axes, "inplace": False} self.outputs = {"Out": self.inputs["X"].reshape(new_shape)} def test_check_output(self): @@ -122,7 +122,7 @@ class TestSqueezeOpInplace2(OpTest): self.op_type = "squeeze" self.inputs = {"X": np.random.random(ori_shape).astype("float32")} - self.attrs = {"axes": axes, "inpalce": True} + self.attrs = {"axes": axes, "inplace": True} self.outputs = {"Out": self.inputs["X"].reshape(new_shape)} def test_check_output(self): @@ -141,7 +141,7 @@ class TestSqueezeOpInplace3(OpTest): self.op_type = "squeeze" self.inputs = {"X": np.random.random(ori_shape).astype("float32")} - self.attrs = {"axes": axes, "inpalce": True} + self.attrs = {"axes": axes, "inplace": True} self.outputs = {"Out": self.inputs["X"].reshape(new_shape)} def test_check_output(self): @@ -154,13 +154,13 @@ class TestSqueezeOpInplace3(OpTest): # Correct: Inpalce. Just part of axes be squeezed. class TestSqueezeOpInplace4(OpTest): def setUp(self): - ori_shape = (1, 3, 1, 5, 1, 4, 1) - axes = (2, 6) - new_shape = (1, 3, 5, 1, 4) + ori_shape = (3, 1, 5, 1, 4, 1) + axes = (1, -1) + new_shape = (3, 5, 1, 4) self.op_type = "squeeze" self.inputs = {"X": np.random.random(ori_shape).astype("float32")} - self.attrs = {"axes": axes, "inpalce": True} + self.attrs = {"axes": axes, "inplace": True} self.outputs = {"Out": self.inputs["X"].reshape(new_shape)} def test_check_output(self):