diff --git a/python/paddle/fluid/tests/unittests/test_slice_op.py b/python/paddle/fluid/tests/unittests/test_slice_op.py index cdffb6fb37fb862aac95b4a869b22fed62a74c1c..41a4d35d906fe112caaa5d3a2c7b3e1a209b93e6 100644 --- a/python/paddle/fluid/tests/unittests/test_slice_op.py +++ b/python/paddle/fluid/tests/unittests/test_slice_op.py @@ -635,7 +635,7 @@ class TestSliceApiEager(unittest.TestCase): axes=axes, starts=paddle.to_tensor(starts), ends=paddle.to_tensor(ends)) - + self.assertTrue(np.array_equal(a_1.numpy(), a_2.numpy())) a_1.backward() grad_truth = paddle.zeros_like(a) grad_truth[-3:3, 0:2, 2:4] = 1 diff --git a/python/paddle/tensor/manipulation.py b/python/paddle/tensor/manipulation.py index a280baa17b1a5433e8d8b18478859b83581892ab..a821d6f72fc540298e4c1cc272e89dafba17d6cb 100755 --- a/python/paddle/tensor/manipulation.py +++ b/python/paddle/tensor/manipulation.py @@ -208,7 +208,7 @@ def slice(input, axes, starts, ends): if isinstance(item, tmp_tensor_type) else item for item in ends ] elif isinstance(ends, tmp_tensor_type): - etensor_t = ends.numpy() + tensor_t = ends.numpy() ends = [ele for ele in tensor_t] infer_flags = list(-1 for i in range(len(axes)))