未验证 提交 6a1ddd61 编写于 作者: J JingZhuangzhuang 提交者: GitHub

[cherry pick]fix paddle tensor numel check (#41665)

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