-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error msg/polish tensor error msg #26976
Error msg/polish tensor error msg #26976
Conversation
Thanks for your contribution! |
✅ This PR's description meets the template requirements! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job!
paddle/fluid/framework/tensor.cc
Outdated
PADDLE_ENFORCE_NOT_NULL(holder_, platform::errors::PreconditionNotMet( | ||
"The `holder_` of Tensor is nullptr. " | ||
"Tensor holds no memory. " | ||
"Call Tensor::mutable_data first.")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
first
-> firstly
may be better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thx
paddle/fluid/framework/tensor.cc
Outdated
"first to re-allocate memory.\n" | ||
"or maybe the required data-type mismatches the data already stored."); | ||
platform::errors::PreconditionNotMet( | ||
"Tensor's dims_ is out of bound." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dims_
-> dimension
may be better, users may not understand dims_
, we need to show users standard English word
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thx
paddle/fluid/framework/tensor.cc
Outdated
"or maybe the required data-type mismatches the data already stored."); | ||
platform::errors::PreconditionNotMet( | ||
"Tensor's dims_ is out of bound." | ||
"Tensor's dims_ must be equal or lesser than the size of memory." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe size of its memory
is better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thx
paddle/fluid/framework/tensor.cc
Outdated
platform::errors::PreconditionNotMet( | ||
"Tensor's dims_ is out of bound." | ||
"Tensor's dims_ must be equal or lesser than the size of memory." | ||
"But received Tensor's dims_ = d%, memory's size = %d.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think =
can directly replaced by is
, try to use English word
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thx
paddle/fluid/framework/tensor.cc
Outdated
platform::errors::PreconditionNotMet( | ||
"The Tensor's numel must be " | ||
"equal or larger than zero. " | ||
"Please check Tensor::dims, or Tensor::Resize has been " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
user may not kown the Tensor::dims
and Tensor::Resize
, because they are interal method, we can only tell users the The tensor's element number is illegal, it must be equal or larger than zero, but actually it's %d, and tensor shape is [%s]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thx
paddle/fluid/framework/tensor.cc
Outdated
PADDLE_ENFORCE_GE(requested_size, size); | ||
PADDLE_ENFORCE_GE(requested_size, size, | ||
platform::errors::InvalidArgument( | ||
"The requested memory size is less than the tensor." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make sure less than
and lesser than
, which is correct grammar?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thx
paddle/fluid/framework/tensor.cc
Outdated
PADDLE_ENFORCE_GE(requested_size, size, | ||
platform::errors::InvalidArgument( | ||
"The requested memory size is less than the tensor." | ||
"But received the requested memory size is d%, " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only need one blank, and maybe the
can be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thx
paddle/fluid/framework/tensor.cc
Outdated
this->holder_, "Cannot invoke mutable data if current hold nothing."); | ||
PADDLE_ENFORCE_NOT_NULL(this->holder_, | ||
platform::errors::PreconditionNotMet( | ||
"The `holder_` of Tensor is nullptr.")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can adjust the holder_
, because users also doesn't know what is holder_
, when holder is null, the tensor is not be initialized, maybe we can tell user The tensor is not initialized.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thx
paddle/fluid/framework/tensor.cc
Outdated
PADDLE_ENFORCE_GE( | ||
begin_idx, 0, | ||
platform::errors::OutOfRange("The start row index must be greater than 0." | ||
"But received the start index is d%.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
multiple blank between received the
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thx
paddle/fluid/framework/tensor.cc
Outdated
PADDLE_ENFORCE_LT( | ||
begin_idx, end_idx, | ||
"The start row index must be lesser than the end row index."); | ||
platform::errors::InvalidArgument( | ||
"The start row index must be lesser than the end row index." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same above lesser than
or less than
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done,thx
Testing/Temporary/LastTest.log
Outdated
@@ -0,0 +1,3 @@ | |||
Start testing: Sep 04 06:09 UTC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these two temporary filles need to be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thx.
paddle/fluid/framework/tensor.cc
Outdated
PADDLE_ENFORCE_GE( | ||
numel(), 0, | ||
platform::errors::PreconditionNotMet( | ||
"The Tensor's element number must be equal or larger than zero. " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
larger
-> greater
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thx.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PR types
Function optimization
PR changes
Others
Describe
Polish error message in tensor implementions