diff --git a/paddle/phi/infermeta/ternary.cc b/paddle/phi/infermeta/ternary.cc index 9f787d077532a6e880dd88382657e886730ac327..d2f1c78eb0b863fd963bbee1c361af3c87572c08 100644 --- a/paddle/phi/infermeta/ternary.cc +++ b/paddle/phi/infermeta/ternary.cc @@ -1073,7 +1073,7 @@ void ScatterNdAddInferMeta(const MetaTensor& x, index_dims[index_dims_size - 1], ref_dims_size)); PADDLE_ENFORCE_GE(index_dims_size, - 2UL, + 1UL, phi::errors::InvalidArgument( "The rank of Input(Index) should be greater than 1, " "but received the rank of Input(Index) is %d.", diff --git a/python/paddle/fluid/tests/unittests/test_gather_nd_op.py b/python/paddle/fluid/tests/unittests/test_gather_nd_op.py index 4916a814a230be86916d8965d9c96f4357f89376..6fc85d1597d171dbe861531818c584e2306b56c1 100644 --- a/python/paddle/fluid/tests/unittests/test_gather_nd_op.py +++ b/python/paddle/fluid/tests/unittests/test_gather_nd_op.py @@ -54,7 +54,7 @@ class TestGatherNdOpWithIndex1(OpTest): self.check_output(check_eager=False) def test_check_grad(self): - self.check_grad(['X'], 'Out', check_eager=False) + self.check_grad(['X'], 'Out', check_eager=False, check_prim=True) class TestGatherNdOpWithLowIndex(OpTest):