未验证 提交 59357f4f 编写于 作者: Q Qiao Longfei 提交者: GitHub

fix floor_op (#7926)

上级 4fb3c676
...@@ -323,7 +323,7 @@ template <typename T> ...@@ -323,7 +323,7 @@ template <typename T>
struct FloorFunctor : public BaseActivationFunctor<T> { struct FloorFunctor : public BaseActivationFunctor<T> {
template <typename Device, typename X, typename Out> template <typename Device, typename X, typename Out>
void operator()(Device d, X x, Out out) const { void operator()(Device d, X x, Out out) const {
out.device(d) = x.ceil(); out.device(d) = x.floor();
} }
}; };
......
...@@ -186,8 +186,7 @@ class TestFloor(OpTest): ...@@ -186,8 +186,7 @@ class TestFloor(OpTest):
self.op_type = "floor" self.op_type = "floor"
x = np.random.uniform(-1, 1, [4, 4]).astype("float32") x = np.random.uniform(-1, 1, [4, 4]).astype("float32")
self.inputs = {'X': x} self.inputs = {'X': x}
# numpy floor need +1 self.outputs = {'Out': np.floor(self.inputs['X'])}
self.outputs = {'Out': np.floor(self.inputs['X']) + 1.0}
def test_check_output(self): def test_check_output(self):
self.check_output() self.check_output()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册