!49450 [MSLITE] Fix document of topk operator.

Merge pull request !49450 from wangshaocong/bugfix
This commit is contained in:
i-robot 2023-03-02 13:21:53 +00:00 committed by Gitee
commit 3179893eeb
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 3 additions and 20 deletions

View File

@ -21,7 +21,7 @@
- **sorted** (bool, 可选) - 如果为True则获取的元素将按值降序排序。如果为False则不对获取的元素进行排序。默认值True。
输入:
- **input_x** (Tensor) - 需计算的输入数据类型必须为float16、float32或int32。
- **input_x** (Tensor) - 需计算的输入,CPU推理数据类型必须为float16、float32或int32GPU推理数据类型必须为float16或float32。
- **k** (int) - 指定计算最大元素的数量,必须为常量。
输出:

View File

@ -36,14 +36,6 @@ MS_REG_GPU_KERNEL_TWO(TopK,
.AddOutputAttr(kNumberTypeInt32),
TopKGpuKernelMod, half, int)
MS_REG_GPU_KERNEL_TWO(TopK,
KernelAttr()
.AddInputAttr(kNumberTypeInt32)
.AddInputAttr(kNumberTypeInt32)
.AddOutputAttr(kNumberTypeInt32)
.AddOutputAttr(kNumberTypeInt32),
TopKGpuKernelMod, int, int)
MS_REG_GPU_KERNEL_TWO(TopK,
KernelAttr()
.AddInputAttr(kNumberTypeFloat32)
@ -59,13 +51,5 @@ MS_REG_GPU_KERNEL_TWO(TopK,
.AddOutputAttr(kNumberTypeFloat16)
.AddOutputAttr(kNumberTypeInt32),
TopKGpuKernelMod, half, int)
MS_REG_GPU_KERNEL_TWO(TopK,
KernelAttr()
.AddInputAttr(kNumberTypeInt32)
.AddInputAttr(kNumberTypeInt64)
.AddOutputAttr(kNumberTypeInt32)
.AddOutputAttr(kNumberTypeInt32),
TopKGpuKernelMod, int, int)
} // namespace kernel
} // namespace mindspore

View File

@ -226,5 +226,3 @@ template CUDA_LIB_EXPORT void FastTopK(const int outer_size, const int inner_siz
half *output, int *output_index, const half init_K, cudaStream_t stream);
template CUDA_LIB_EXPORT void FastTopK(const int outer_size, const int inner_size, const float *input, int k_cut,
float *output, int *output_index, const float init_K, cudaStream_t stream);
template CUDA_LIB_EXPORT void FastTopK(const int outer_size, const int inner_size, const int *input, int k_cut,
int *output, int *output_index, const int init_K, cudaStream_t stream);

View File

@ -7950,7 +7950,8 @@ class TopK(Primitive):
If False, the obtained elements will not be sorted. Default: True.
Inputs:
- **input_x** (Tensor) - Input to be computed, data type must be float16, float32 or int32.
- **input_x** (Tensor) - Input to be computed, data type must be float16, float32 or int32 on CPU,
and float16 or float32 on GPU.
- **k** (int) - The number of top elements to be computed along the last dimension, constant input is needed.
Outputs: