未验证 提交 97847ae8 编写于 作者: X xiaoguoguo626807 提交者: GitHub

modify slice op Infershape (#45855)

* modify slice infershape

* code style

* modify slice_unittest
上级 c252b1de
......@@ -117,6 +117,10 @@ inline phi::DDim GetSliceDims(const phi::DDim in_dims,
continue;
}
if (in_dims[axis] == -1) {
continue;
}
T start = starts[i];
T end = ends[i];
T step = steps == nullptr ? 1 : (*steps)[i];
......
......@@ -784,7 +784,7 @@ class TestInferShape(unittest.TestCase):
self.assertEqual(x.shape, (3, -1, 5))
out0 = paddle.slice(x, axes=[1], starts=[0], ends=[3])
self.assertEqual(out0.shape, (3, 3, 5))
self.assertEqual(out0.shape, (3, -1, 5))
def test_axis_less_than_zero(self):
# Using paddle.disable_static will make other unittests fail.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册