From f7a3389eb5d5786bcf0008b2da1dfcac9276338f Mon Sep 17 00:00:00 2001 From: zyfncg Date: Thu, 10 Feb 2022 18:00:41 +0800 Subject: [PATCH] fix check error of ResetHolder (#39439) --- paddle/pten/core/dense_tensor_impl.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/paddle/pten/core/dense_tensor_impl.cc b/paddle/pten/core/dense_tensor_impl.cc index 18702c85b0..80c66c0571 100644 --- a/paddle/pten/core/dense_tensor_impl.cc +++ b/paddle/pten/core/dense_tensor_impl.cc @@ -85,7 +85,8 @@ void DenseTensor::ResetHolder(const std::shared_ptr& holder) { // compare with a data with unsigned long type, this will make checking // failed, so it's a temporary solution to deal with this problem. PADDLE_ENFORCE_LE( - numel() * static_cast(SizeOf(dtype())) + meta_.offset, + numel() * static_cast(SizeOf(dtype())) + + static_cast(meta_.offset), static_cast(holder->size()), paddle::platform::errors::InvalidArgument( "The size of Holder is not enough to store the Tensor.")); -- GitLab