Skip to content

Commit

Permalink
don't exit if requested_size < size (#37880)
Browse files Browse the repository at this point in the history
don't exit if requested_size < size
  • Loading branch information
b3602sss committed Dec 7, 2021
1 parent 508b756 commit 4035bd2
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions paddle/fluid/framework/tensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,7 @@ void* Tensor::mutable_data(const platform::Place& place,
"The Tensor's shape is [",
dims(), "] now"));
size_t size = numel() * SizeOfType(type);
if (requested_size) {
PADDLE_ENFORCE_GE(
requested_size, size,
platform::errors::InvalidArgument(
"The requested memory size is less than the memory size of Tensor. "
"But received requested memory size is %d, "
"memory size of Tensor is %d.",
requested_size, size));
if (requested_size && (requested_size > size)) {
size = requested_size;
}
/* some versions of boost::variant don't have operator!= */
Expand Down

0 comments on commit 4035bd2

Please sign in to comment.