提交 f2756a1b 编写于 作者: M Megvii Engine Team

refactor(imperative): change the default descending args of topk from False to True

GitOrigin-RevId: 7c577284463738bb60e2e14f6c27a733f1e7eace
上级 06ba043a
...@@ -631,11 +631,10 @@ def sort(inp: Tensor, descending: bool = False) -> Tuple[Tensor, Tensor]: ...@@ -631,11 +631,10 @@ def sort(inp: Tensor, descending: bool = False) -> Tuple[Tensor, Tensor]:
return tns, ind return tns, ind
@deprecated_kwargs_default("1.12", "descending", 3)
def topk( def topk(
inp: Tensor, inp: Tensor,
k: int, k: int,
descending: bool = False, descending: bool = True,
kth_only: bool = False, kth_only: bool = False,
no_sort: bool = False, no_sort: bool = False,
) -> Tuple[Tensor, Tensor]: ) -> Tuple[Tensor, Tensor]:
...@@ -644,7 +643,7 @@ def topk( ...@@ -644,7 +643,7 @@ def topk(
Args: Args:
inp: input tensor. If input tensor is 2d, each row will be sorted. inp: input tensor. If input tensor is 2d, each row will be sorted.
k: number of elements needed. k: number of elements needed.
descending: if True, return the largest elements instead. Default: False descending: if True, return the largest elements. Default: True
kth_only: if True, only the k-th element will be returned. Default: False kth_only: if True, only the k-th element will be returned. Default: False
no_sort: if True, the returned elements can be unordered. Default: False no_sort: if True, the returned elements can be unordered. Default: False
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册