未验证 提交 51cae7f7 编写于 作者: J JingZhuangzhuang 提交者: GitHub

fix_paddle_numel_check (#41607)

* fix_paddle_numel_check

* fix_paddle_numel_check
上级 bc01242b
...@@ -99,8 +99,9 @@ struct GpuLaunchConfig { ...@@ -99,8 +99,9 @@ struct GpuLaunchConfig {
inline GpuLaunchConfig GetGpuLaunchConfig1D( inline GpuLaunchConfig GetGpuLaunchConfig1D(
const platform::CUDADeviceContext& context, int64_t numel, const platform::CUDADeviceContext& context, int64_t numel,
int vec_size = 1) { int vec_size = 1) {
PADDLE_ENFORCE_GT(numel, 0, platform::errors::InvalidArgument( PADDLE_ENFORCE_GE(numel, 0,
"element quantity should be greater than 0," platform::errors::InvalidArgument(
"element quantity should be greater than or equal 0,"
" but received value is: %d.", " but received value is: %d.",
numel)); numel));
// Get compute_capability // Get compute_capability
......
...@@ -101,10 +101,10 @@ struct GpuLaunchConfig { ...@@ -101,10 +101,10 @@ struct GpuLaunchConfig {
inline GpuLaunchConfig GetGpuLaunchConfig1D(const phi::GPUContext& context, inline GpuLaunchConfig GetGpuLaunchConfig1D(const phi::GPUContext& context,
int64_t numel, int64_t numel,
int vec_size = 1) { int vec_size = 1) {
PADDLE_ENFORCE_GT( PADDLE_ENFORCE_GE(numel,
numel,
0, 0,
phi::errors::InvalidArgument("element quantity should be greater than 0," phi::errors::InvalidArgument(
"element quantity should be greater than or equal 0,"
" but received value is: %d.", " but received value is: %d.",
numel)); numel));
// Get compute_capability // Get compute_capability
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册