From 59357f4fb94d4589b9b51a33d1f3febb00653779 Mon Sep 17 00:00:00 2001 From: Qiao Longfei Date: Mon, 29 Jan 2018 07:15:44 +0800 Subject: [PATCH] fix floor_op (#7926) --- paddle/operators/activation_op.h | 2 +- python/paddle/v2/fluid/tests/test_activation_op.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/paddle/operators/activation_op.h b/paddle/operators/activation_op.h index 88c3d1c597..c0809abc05 100644 --- a/paddle/operators/activation_op.h +++ b/paddle/operators/activation_op.h @@ -323,7 +323,7 @@ template struct FloorFunctor : public BaseActivationFunctor { template void operator()(Device d, X x, Out out) const { - out.device(d) = x.ceil(); + out.device(d) = x.floor(); } }; diff --git a/python/paddle/v2/fluid/tests/test_activation_op.py b/python/paddle/v2/fluid/tests/test_activation_op.py index 18605e6065..1de5d446b8 100644 --- a/python/paddle/v2/fluid/tests/test_activation_op.py +++ b/python/paddle/v2/fluid/tests/test_activation_op.py @@ -186,8 +186,7 @@ class TestFloor(OpTest): self.op_type = "floor" x = np.random.uniform(-1, 1, [4, 4]).astype("float32") self.inputs = {'X': x} - # numpy floor need +1 - self.outputs = {'Out': np.floor(self.inputs['X']) + 1.0} + self.outputs = {'Out': np.floor(self.inputs['X'])} def test_check_output(self): self.check_output() -- GitLab