Skip to content

Commit

Permalink
Revert "cherry pick: reduce log for type promotion. (PaddlePaddle#62116
Browse files Browse the repository at this point in the history
…)"

This reverts commit f4d9adf.
  • Loading branch information
hanhaowen-mt committed May 13, 2024
1 parent 9611848 commit 4cdc2d7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@ paddle::Tensor multiply_ad_func(const paddle::Tensor& x,
// Type promotion Logic
if (phi::NeedTypePromotion(x.dtype(), y.dtype())) {
VLOG(5) << "got different data type, run type protmotion automatically.";
LOG_FIRST_N(WARNING, 1)
<< "got different data type, run type protmotion "
"automatically, this may cause data type been changed.";
LOG(WARNING) << "got different data type, run type protmotion "
"automatically, this may cause data type been changed.";
auto op_name = phi::TransToFluidOpName("multiply");
auto promotion_type = phi::GetPromoteDtype(op_name, x.dtype(), y.dtype());

Expand Down Expand Up @@ -408,9 +407,8 @@ paddle::Tensor multiply_ad_func(const paddle::Tensor& x,
// Type promotion Logic
if (phi::NeedTypePromotion(x.dtype(), y.dtype())) {
VLOG(5) << "got different data type, run type protmotion automatically.";
LOG_FIRST_N(WARNING, 1)
<< "got different data type, run type protmotion "
"automatically, this may cause data type been changed.";
LOG(WARNING) << "got different data type, run type protmotion "
"automatically, this may cause data type been changed.";
auto op_name = phi::TransToFluidOpName("multiply");
auto promotion_type = phi::GetPromoteDtype(op_name, x.dtype(), y.dtype());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ class {} : public egr::GradNodeBase {{

TYPE_PROMOTION_LOGIC_TEMPLATE = """ if (phi::NeedTypePromotion({x}.dtype(), {y}.dtype())) {{
VLOG(5) << "got different data type, run type protmotion automatically.";
LOG_FIRST_N(WARNING, 1) << "got different data type, run type protmotion automatically, this may cause data type been changed.";
LOG(WARNING) << "got different data type, run type protmotion automatically, this may cause data type been changed.";
{op_name}
auto promotion_type = phi::GetPromoteDtype(op_name, {x}.dtype(), {y}.dtype());
Expand Down
6 changes: 2 additions & 4 deletions python/paddle/base/layers/math_op_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,10 +538,8 @@ def __impl__(self, other_var):
op_type, lhs_dtype, rhs_dtype
)
warnings.warn(
f"The input dtypes of OP {op_type} are {lhs_dtype} and {rhs_dtype}, the output will be auto-promoted to {common_dtype}"
)
warnings.filterwarnings(
"ignore", message="The input dtypes of OP"
f"The input dtypes of OP {op_type} are {lhs_dtype} and {rhs_dtype}, "
"the output will be auto-promoted to {common_dtype}"
)
if rhs_dtype != common_dtype:
other_var = astype(other_var, common_dtype)
Expand Down

0 comments on commit 4cdc2d7

Please sign in to comment.