未验证 提交 4035bd2b 编写于 作者: W wenbin 提交者: GitHub

don't exit if requested_size < size (#37880)

don't exit if requested_size < size
上级 508b756a
......@@ -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!= */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册