File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
src/plugins/intel_cpu/src/nodes Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -2511,16 +2511,17 @@ void TopK::topk_ref_process(const float* src_data,
25112511 }
25122512 for (int i2 = 0 ; i2 < top_k - 1 ; i2++) {
25132513 for (int i3 = top_k - 1 ; i3 > i2; i3--) {
2514- if (compare (max_values[i3], max_values[i3 - 1 ])) {
2514+ if (std::isnan (max_values[i3 - 1 ]) || compare (max_values[i3], max_values[i3 - 1 ])) {
25152515 swap_func (i3, i3 - 1 );
25162516 }
25172517 }
25182518 }
2519+ // 2. Main Scan Loop
25192520 for (int i2 = top_k; i2 < dim; i2++) {
25202521 max_values[top_k] = src_data[s_index];
25212522 max_indexes[top_k] = i2;
25222523 for (int i3 = top_k; i3 > 0 ; i3--) {
2523- if (compare (max_values[i3], max_values[i3 - 1 ])) {
2524+ if (std::isnan (max_values[i3 - 1 ]) || compare (max_values[i3], max_values[i3 - 1 ])) {
25242525 swap_func (i3, i3 - 1 );
25252526 } else {
25262527 break ;
You can’t perform that action at this time.
0 commit comments