未验证 提交 e0ee7403 编写于 作者: T Thomas Young 提交者: GitHub

fix bug (#49546)

上级 d00c2ca6
...@@ -31,6 +31,14 @@ static void FullTopK(Type input_height, ...@@ -31,6 +31,14 @@ static void FullTopK(Type input_height,
const int& k, const int& k,
const bool& largest, const bool& largest,
const bool& sorted) { const bool& sorted) {
PADDLE_ENFORCE_LE(
k,
input_width,
errors::InvalidArgument("The rank (%d) of the input 'k' for "
"topk op must be less than or equal to %d.",
k,
input_width));
// when the k is small, will the partial sort // when the k is small, will the partial sort
bool partial_sort_flag = (k * 64) < input_width; bool partial_sort_flag = (k * 64) < input_width;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册