diff --git a/paddle/fluid/platform/device/gpu/gpu_launch_config.h b/paddle/fluid/platform/device/gpu/gpu_launch_config.h index 4a550e61d42da48aa9aa6adf97e0d6b634f12f5d..6e1f324625d2b01a0c9acf184c6befd1f44c4b53 100644 --- a/paddle/fluid/platform/device/gpu/gpu_launch_config.h +++ b/paddle/fluid/platform/device/gpu/gpu_launch_config.h @@ -99,10 +99,11 @@ struct GpuLaunchConfig { inline GpuLaunchConfig GetGpuLaunchConfig1D( const platform::CUDADeviceContext& context, int64_t numel, int vec_size = 1) { - PADDLE_ENFORCE_GT(numel, 0, platform::errors::InvalidArgument( - "element quantity should be greater than 0," - " but received value is: %d.", - numel)); + PADDLE_ENFORCE_GE(numel, 0, + platform::errors::InvalidArgument( + "element quantity should be greater than or equal to 0," + " but received value is: %d.", + numel)); // Get compute_capability const int capability = context.GetComputeCapability(); /* If thread number per block is 64/128/256/512, cuda performs better.*/ diff --git a/paddle/phi/backends/gpu/gpu_launch_config.h b/paddle/phi/backends/gpu/gpu_launch_config.h index ea54083e8179b6744605281103d96d59b81cebe5..70466e2d7532109384f41efb4c7a0d427d5f422f 100644 --- a/paddle/phi/backends/gpu/gpu_launch_config.h +++ b/paddle/phi/backends/gpu/gpu_launch_config.h @@ -101,12 +101,12 @@ struct GpuLaunchConfig { inline GpuLaunchConfig GetGpuLaunchConfig1D(const phi::GPUContext& context, int64_t numel, int vec_size = 1) { - PADDLE_ENFORCE_GT( - numel, - 0, - phi::errors::InvalidArgument("element quantity should be greater than 0," - " but received value is: %d.", - numel)); + PADDLE_ENFORCE_GE(numel, + 0, + phi::errors::InvalidArgument( + "element quantity should be greater than or equal to 0," + " but received value is: %d.", + numel)); // Get compute_capability const int capability = context.GetComputeCapability(); /* If thread number per block is 64/128/256/512, cuda performs better.*/