Skip to content

Commit

Permalink
fix windows openblas ci fail
Browse files Browse the repository at this point in the history
  • Loading branch information
qili93 committed May 28, 2024
1 parent 946cb3c commit 7da3a74
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions paddle/phi/kernels/cpu/histogram_kernel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,21 @@ void HistogramKernel(const Context& dev_ctx,
output_max = output_max + 1;
}

// check if out of range
double range =
static_cast<double>(output_max) - static_cast<double>(output_min);
PADDLE_ENFORCE_LT(
range,
static_cast<double>(std::numeric_limits<T>::max()),
phi::errors::InvalidArgument(
"The range of max - min is out of range for target type, "
"current kernel type is %s, the range should less than %f "
"but now min is %f, max is %f.",
typeid(T).name(),
std::numeric_limits<T>::max(),
output_min,
output_max));

PADDLE_ENFORCE_EQ((std::isinf(static_cast<float>(output_min)) ||
std::isnan(static_cast<float>(output_max)) ||
std::isinf(static_cast<float>(output_min)) ||
Expand Down

0 comments on commit 7da3a74

Please sign in to comment.