diff --git a/oneflow/core/functional/impl/common.cpp b/oneflow/core/functional/impl/common.cpp index 24b123aee87..a175873c06a 100644 --- a/oneflow/core/functional/impl/common.cpp +++ b/oneflow/core/functional/impl/common.cpp @@ -206,9 +206,8 @@ Maybe CheckInplaceShapeCanExpandTo(const Shape& shape, const Shape& expand Maybe CheckSizeNonNegative(const Shape& shape) { for (const auto& s : shape) { - CHECK_OR_THROW(s >= 0) - << "Trying to create tensor with negative dimension " << s << ": " - << shape; + CHECK_OR_RETURN(s >= 0) << "Trying to create tensor with negative dimension " << s << ": " + << shape; } return Maybe::Ok(); }