fix topk param docs
This commit is contained in:
parent
79fbf20385
commit
d3d9e2bc74
|
@ -6,7 +6,7 @@
|
|||
沿最后一个维度查找 `k` 个最大元素和对应的索引。
|
||||
|
||||
.. warning::
|
||||
- 如果 `sorted` 设置为False,它将使用aicpu运算符,性能可能会降低。
|
||||
- 如果 `sorted` 设置为False,它将使用aicpu运算符,性能可能会降低,另外,由于在不同平台上存在内存排布以及遍历方式不同等问题,`sorted` 设置为False时计算结果的显示顺序可能会出现不一致的情况。
|
||||
|
||||
如果 `input_x` 是一维Tensor,则查找Tensor中 `k` 个最大元素,并将其值和索引输出为Tensor。`values[k]` 是 `input_x` 中 `k` 个最大元素,其索引是 `indices[k]` 。
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
|||
如果两个比较的元素相同,则优先返回索引值较小的元素。
|
||||
|
||||
参数:
|
||||
- **sorted** (bool, 可选) - 如果为True,则获取的元素将按值降序排序。如果为False,则获取的元素将按值升序排序。默认值:True。
|
||||
- **sorted** (bool, 可选) - 如果为True,则获取的元素将按值降序排序。如果为False,则不对获取的元素进行排序。默认值:True。
|
||||
|
||||
输入:
|
||||
- **input_x** (Tensor) - 需计算的输入,数据类型必须为float16、float32或int32。
|
||||
|
|
|
@ -6,7 +6,7 @@ mindspore.ops.topk
|
|||
沿给定维度查找 `k` 个最大或最小元素和对应的索引。
|
||||
|
||||
.. warning::
|
||||
- 如果 `sorted` 设置为False,它将使用aicpu运算符,性能可能会降低。
|
||||
- 如果 `sorted` 设置为False,它将使用aicpu运算符,性能可能会降低,另外,由于在不同平台上存在内存排布以及遍历方式不同等问题,`sorted` 设置为False时计算结果的显示顺序可能会出现不一致的情况。
|
||||
|
||||
如果 `input_x` 是一维Tensor,则查找Tensor中 `k` 个最大或最小元素,并将其值和索引输出为Tensor。`values[k]` 是 `input_x` 中 `k` 个最大元素,其索引是 `indices[k]` 。
|
||||
|
||||
|
@ -22,7 +22,7 @@ mindspore.ops.topk
|
|||
- **k** (int) - 指定计算最大或最小元素的数量,必须为常量。
|
||||
- **dim** (int, 可选) - 需要排序的维度。默认值:None。
|
||||
- **largest** (bool, 可选) - 如果为False,则会返回前k个最小值。默认值:True。
|
||||
- **sorted** (bool, 可选) - 如果为True,则获取的元素将按值降序排序。如果为False,则获取的元素将按值升序排序。默认值:True。
|
||||
- **sorted** (bool, 可选) - 如果为True,则获取的元素将按值降序排序。如果为False,则不对获取的元素进行排序。默认值:True。
|
||||
|
||||
返回:
|
||||
由 `values` 和 `indices` 组成的tuple。
|
||||
|
|
|
@ -5692,7 +5692,9 @@ def topk(input_x, k, dim=None, largest=True, sorted=True):
|
|||
Finds values and indices of the `k` largest or smallest entries along a given dimension.
|
||||
|
||||
.. warning::
|
||||
- If sorted is set to False, it will use the aicpu operator, the performance may be reduced.
|
||||
- If sorted is set to False, it will use the aicpu operator, the performance may be reduced. In addition, due to
|
||||
different memory layout and traversal methods on different platforms, the display order of calculation results
|
||||
may be inconsistent when `sorted` is False.
|
||||
|
||||
If the `input_x` is a one-dimensional Tensor, finds the `k` largest or smallest entries in the Tensor,
|
||||
and outputs its value and index as a Tensor. values[`k`] is the `k` largest item in `input_x`,
|
||||
|
@ -5713,7 +5715,7 @@ def topk(input_x, k, dim=None, largest=True, sorted=True):
|
|||
dim (int, optional): The dimension to sort along. Default: None.
|
||||
largest (bool, optional): If largest is False then the k smallest elements are returned. Default: True.
|
||||
sorted (bool, optional): If True, the obtained elements will be sorted by the values in descending order.
|
||||
If False, the obtained elements will be sorted by the values in ascending order. Default: True.
|
||||
If False, the obtained elements will not be sorted. Default: True.
|
||||
|
||||
Returns:
|
||||
A tuple consisting of `values` and `indexes`.
|
||||
|
|
|
@ -7862,7 +7862,9 @@ class TopK(Primitive):
|
|||
Finds values and indices of the `k` largest entries along the last dimension.
|
||||
|
||||
.. warning::
|
||||
- If sorted is set to False, it will use the aicpu operator, the performance may be reduced.
|
||||
- If sorted is set to False, it will use the aicpu operator, the performance may be reduced. In addition, due to
|
||||
different memory layout and traversal methods on different platforms, the display order of calculation results
|
||||
may be inconsistent when `sorted` is False.
|
||||
|
||||
If the `input_x` is a one-dimensional Tensor, finds the `k` largest entries in the Tensor,
|
||||
and outputs its value and index as a Tensor. values[`k`] is the `k` largest item in `input_x`,
|
||||
|
@ -7879,7 +7881,7 @@ class TopK(Primitive):
|
|||
|
||||
Args:
|
||||
sorted (bool, optional): If True, the obtained elements will be sorted by the values in descending order.
|
||||
If False, the obtained elements will be sorted by the values in ascending order. Default: True.
|
||||
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.
|
||||
|
|
Loading…
Reference in New Issue