diff --git a/mindspore/ccsrc/backend/kernel_compiler/gpu/arrays/topk_gpu_kernel.h b/mindspore/ccsrc/backend/kernel_compiler/gpu/arrays/topk_gpu_kernel.h index 4b6d8021c5d..b07a37f621d 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/gpu/arrays/topk_gpu_kernel.h +++ b/mindspore/ccsrc/backend/kernel_compiler/gpu/arrays/topk_gpu_kernel.h @@ -41,7 +41,13 @@ class TopKGpuKernel : public GpuKernel { S *k = GetDeviceAddress(inputs, 1); T *output_addr = GetDeviceAddress(outputs, 0); S *indices = GetDeviceAddress(outputs, 1); - const T init_k = std::numeric_limits::lowest(); + + T init_k = std::numeric_limits::lowest(); + if (std::is_same::value) { + // min value representable by float16, std::numeric_limits doesn't support half + init_k = static_cast(-65504.); + } + S k_cut = 0; CHECK_CUDA_RET_WITH_EXCEPT( kernel_node_,