Skip to content

Commit 73b235f

Browse files
ooooo-createEnigmatisms
authored andcommitted
refine some error message to avoid linking words together part6 (PaddlePaddle#74520)
1 parent 5ed7519 commit 73b235f

File tree

18 files changed

+42
-40
lines changed

18 files changed

+42
-40
lines changed

paddle/fluid/operators/collective/c_embedding_op.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class CEmbeddingOpMaker : public framework::OpProtoAndCheckerMaker {
8787
"and the out-of-bounds will be set to 0 ")
8888
.SetDefault(0);
8989
AddAttr<int64_t>("vocab_size",
90-
"(int64, default -1), The total vocabulary size to check"
90+
"(int64, default -1), The total vocabulary size to check "
9191
"the out-of-bounds ids. If it is -1, no check will be ")
9292
.SetDefault(-1);
9393
AddComment(R"DOC(

paddle/fluid/operators/memcpy_d2h_op.cc

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,13 @@ class MemcpyD2HOpProtoMaker : public framework::OpProtoAndCheckerMaker {
6262
AddOutput("Out",
6363
"(phi::DenseTensor) The type of output "
6464
"is the same as input X.");
65-
AddAttr<int>("dst_place_type",
66-
"Determine the dst place of tensor copy. "
67-
"By Now it ONLY support XPU/CUDAPlace <-> CUDAPinnedPlace/CPU"
68-
"Other place type is Unimplemented and will cause ERROR."
69-
"0: dst is on CPUPlace. "
70-
"1: dst is on CUDAPinnedPlace. ");
65+
AddAttr<int>(
66+
"dst_place_type",
67+
"Determine the dst place of tensor copy. "
68+
"By Now it ONLY support XPU/CUDAPlace <-> CUDAPinnedPlace/CPU. "
69+
"Other place type is Unimplemented and will cause ERROR. "
70+
"0: dst is on CPUPlace. "
71+
"1: dst is on CUDAPinnedPlace. ");
7172
AddComment(R"DOC(
7273
MemcpyD2H Operator.
7374
By now, it ONLY supports the memcopy between CUDAPlace <-> CUDAPinnedPlace/CPU.

paddle/fluid/operators/memcpy_h2d_op.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ class MemcpyH2DOpProtoMaker : public framework::OpProtoAndCheckerMaker {
6464
"is the same as input X.");
6565
AddAttr<int>("dst_place_type",
6666
"Determine the dst place of tensor copy. "
67-
"By Now it support:"
68-
"0. CUDAPinnedPlace/CPU <->CUDAPlace"
69-
"1. CPU <->XPUPlace"
70-
"2. CPU <->IPUPlace"
67+
"By Now it support: "
68+
"0. CUDAPinnedPlace/CPU <->CUDAPlace. "
69+
"1. CPU <->XPUPlace. "
70+
"2. CPU <->IPUPlace. "
7171
"Other place type is Unimplemented and will cause ERROR.");
7272
AddComment(R"DOC(
7373
MemcpyD2H Operator.

paddle/fluid/operators/sum_op.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ class SumOpMaker : public framework::OpProtoAndCheckerMaker {
127127
void Make() override {
128128
AddInput(
129129
"X",
130-
"A Variable list. The shape and data type of the list elements"
131-
"should be consistent. Variable can be multi-dimensional Tensor"
130+
"A Variable list. The shape and data type of the list elements "
131+
"should be consistent. Variable can be multi-dimensional Tensor "
132132
"or phi::DenseTensor, and data types can be: float32, float64, int32, "
133133
"int64.")
134134
.AsDuplicable();

paddle/fluid/pybind/eager.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,7 @@ int TensorInit(PyObject* self, PyObject* args, PyObject* kwargs) {
901901
true,
902902
common::errors::PreconditionNotMet(
903903
"Could not parse args and kwargs successfully, "
904-
"please check your input first and make"
904+
"please check your input first and make "
905905
"sure you are on the right way. "
906906
"The expected arguments as follow: ("
907907
"value, place, persistable, zero_copy, "
@@ -1307,7 +1307,7 @@ int StringTensorInit(PyObject* self, PyObject* args, PyObject* kwargs) {
13071307
true,
13081308
common::errors::PreconditionNotMet(
13091309
"Could not parse args and kwargs successfully, "
1310-
"please check your input first and make"
1310+
"please check your input first and make "
13111311
"sure you are on the right way. "
13121312
"The expected arguments as follow: ("
13131313
"value, zero_copy, name, dims)"));

paddle/fluid/pybind/eager_functions.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,8 +1353,8 @@ static PyObject* eager_api_set_master_grads(PyObject* self,
13531353
PADDLE_ENFORCE_NE(
13541354
grad,
13551355
nullptr,
1356-
common::errors::Fatal("Detected nullptr grad"
1357-
"Please check if you have manually cleared"
1356+
common::errors::Fatal("Detected nullptr grad. "
1357+
"Please check if you have manually cleared "
13581358
"the grad inside autograd_meta"));
13591359
if (((*grad).has_allocation() || (*grad).is_dist_tensor()) &&
13601360
((*grad).dtype() == phi::DataType::FLOAT16 ||

paddle/fluid/pybind/eager_generator.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,7 @@ static void SlotNameMatching(
502502
grad_fwd_slotname_map[grad_slot_name] != fwd_slot_name) {
503503
PADDLE_THROW(common::errors::Fatal(
504504
"Detected mismatched slot names."
505+
"Detected mismatched slot names: "
505506
"grad_slot_name %s matches both %s and %s fwd_slot_name",
506507
grad_slot_name,
507508
grad_fwd_slotname_map[grad_slot_name],
@@ -536,7 +537,7 @@ static void SlotNameMatching(
536537
if (grad_fwd_slotname_map.count(grad_slot_name) &&
537538
grad_fwd_slotname_map[grad_slot_name] != fwd_slot_name) {
538539
PADDLE_THROW(common::errors::Fatal(
539-
"Detected mismatched slot names"
540+
"Detected mismatched slot names: "
540541
"grad_slot_name %s matches both %s and %s fwd_slot_name",
541542
grad_slot_name,
542543
grad_fwd_slotname_map[grad_slot_name],

paddle/fluid/pybind/eager_method.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -931,8 +931,8 @@ static PyObject* tensor_clear_gradient(TensorObject* self,
931931
grad = egr::EagerUtils::mutable_grad(self->tensor);
932932
PADDLE_ENFORCE(
933933
grad != nullptr,
934-
common::errors::Fatal("Detected nullptr grad"
935-
"Please check if you have manually cleared"
934+
common::errors::Fatal("Detected nullptr grad. "
935+
"Please check if you have manually cleared "
936936
"the grad inside autograd_meta"));
937937
} else {
938938
auto meta = egr::EagerUtils::unsafe_autograd_meta(self->tensor);
@@ -995,8 +995,8 @@ static PyObject* tensor__zero_grads(TensorObject* self,
995995
paddle::Tensor* grad = egr::EagerUtils::mutable_grad(self->tensor);
996996
PADDLE_ENFORCE(
997997
grad != nullptr,
998-
common::errors::Fatal("Detected nullptr grad"
999-
"Please check if you have manually cleared"
998+
common::errors::Fatal("Detected nullptr grad. "
999+
"Please check if you have manually cleared "
10001000
"the grad inside autograd_meta"));
10011001
if (grad->initialized()) {
10021002
if (grad->is_dense_tensor() || grad->is_dist_tensor()) {

paddle/fluid/pybind/eager_properties.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -311,8 +311,8 @@ int tensor_properties_set_grad(TensorObject* self,
311311
paddle::Tensor* grad = egr::EagerUtils::mutable_grad(self->tensor);
312312
PADDLE_ENFORCE(
313313
grad != nullptr,
314-
common::errors::Fatal("Detected NULL grad"
315-
"Please check if you have manually cleared"
314+
common::errors::Fatal("Detected NULL grad. "
315+
"Please check if you have manually cleared "
316316
"the grad inside autograd_meta"));
317317
const phi::distributed::ProcessMesh* mesh = nullptr;
318318
if (InputsContainDistTensor(&mesh, src, self->tensor, *grad)) {
@@ -334,8 +334,8 @@ int tensor_properties_set_grad_(TensorObject* self,
334334
paddle::Tensor* grad = egr::EagerUtils::mutable_grad(self->tensor);
335335
PADDLE_ENFORCE(
336336
grad != nullptr,
337-
common::errors::Fatal("Detected NULL grad"
338-
"Please check if you have manually cleared"
337+
common::errors::Fatal("Detected NULL grad. "
338+
"Please check if you have manually cleared "
339339
"the grad inside autograd_meta"));
340340
*grad = src;
341341
return 0;

paddle/fluid/pybind/imperative.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ void BindImperative(py::module *m_ptr) {
737737
} else {
738738
PADDLE_THROW(common::errors::InvalidArgument(
739739
"Incompatible Place Type: supports XPUPlace, CUDAPlace, "
740-
"CPUPlace, IPUPlace, XPUPinnedPlace"
740+
"CPUPlace, IPUPlace, XPUPinnedPlace "
741741
"and CUDAPinnedPlace, "
742742
"but got Unknown Type!"));
743743
}

0 commit comments

Comments
 (0)