Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions paddle/phi/infermeta/multiary.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6320,11 +6320,11 @@ void MoePermuteInferMeta(const MetaTensor& X,
static_cast<int64_t>(std::numeric_limits<int32_t>::max()) - 32,
common::errors::InvalidArgument(
"X.dims()[0] should be <= INT_MAX - 32, but got %ld.", rows));
PADDLE_ENFORCE_GE(
PADDLE_ENFORCE_GT(
Comment thread
cangtianhuang marked this conversation as resolved.
Outdated
Comment thread
cangtianhuang marked this conversation as resolved.
Outdated
cols,
0,
common::errors::InvalidArgument(
"X.dims()[1] should be non-negative, but got %ld.", cols));
"X.dims()[1] should be positive, but got %ld.", cols));
Comment thread
cangtianhuang marked this conversation as resolved.
Outdated
PADDLE_ENFORCE_LE(
cols,
static_cast<int64_t>(std::numeric_limits<int32_t>::max()),
Expand Down Expand Up @@ -6578,12 +6578,12 @@ void MoeUnpermuteInferMeta(const MetaTensor& unzipped_tokens,
const int64_t cols = unzipped_tokens.dims()[1];
const int64_t topk = expert_routemap_topk.dims()[1];
if (!common::contain_unknown_dim(unzipped_tokens.dims())) {
PADDLE_ENFORCE_GE(cols,
0,
common::errors::InvalidArgument(
"unzipped_tokens.dims()[1] should be non-negative, "
"but got %ld.",
cols));
PADDLE_ENFORCE_GT(
Comment thread
cangtianhuang marked this conversation as resolved.
cols,
0,
common::errors::InvalidArgument(
"unzipped_tokens.dims()[1] should be positive, but got %ld.",
cols));
Comment thread
cangtianhuang marked this conversation as resolved.
}
if (!common::contain_unknown_dim(unzipped_tokens.dims()) &&
!common::contain_unknown_dim(unzipped_token_probs.dims())) {
Expand Down
5 changes: 5 additions & 0 deletions paddle/phi/kernels/gpu/moe_permute_kernel.cu
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,11 @@ void MoePermuteKernel(const Context &dev_ctx,
"X.dims()[0] should be <= INT_MAX - %d, received: (%ld)",
kPermuteBlockSize,
rows));
PADDLE_ENFORCE_GT(
cols,
0,
common::errors::InvalidArgument(
"X.dims()[1] should be positive, received: (%ld)", cols));
Comment thread
cangtianhuang marked this conversation as resolved.
PADDLE_ENFORCE_LE(
cols,
std::numeric_limits<int32_t>::max(),
Expand Down
5 changes: 5 additions & 0 deletions paddle/phi/kernels/gpu/moe_unpermute_kernel.cu
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,11 @@ void MoeUnpermuteKernel(const Context &dev_ctx,
unzipped_token_probs.numel(),
unzipped_tokens.dims()[0]));
const int64_t cols = unzipped_tokens.dims()[1];
PADDLE_ENFORCE_GT(
Comment thread
cangtianhuang marked this conversation as resolved.
cols,
0,
common::errors::InvalidArgument(
"unzipped_tokens.dims()[1] should be positive, but got %ld.", cols));
Comment thread
cangtianhuang marked this conversation as resolved.
PADDLE_ENFORCE_LE(cols,
std::numeric_limits<int32_t>::max(),
common::errors::InvalidArgument(
Expand Down
Loading