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

fix_paddle_numel_check (#41607)

* fix_paddle_numel_check

* fix_paddle_numel_check
上级 bc01242b
......@@ -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 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.*/
......
......@@ -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 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.*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册