From f2756a1bcd13be5f5892e7a61abeda8731244dcf Mon Sep 17 00:00:00 2001 From: Megvii Engine Team Date: Fri, 9 Dec 2022 10:36:01 +0800 Subject: [PATCH] refactor(imperative): change the default descending args of topk from False to True GitOrigin-RevId: 7c577284463738bb60e2e14f6c27a733f1e7eace --- imperative/python/megengine/functional/math.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/imperative/python/megengine/functional/math.py b/imperative/python/megengine/functional/math.py index 4ae82c1e1..fe20d8fbf 100644 --- a/imperative/python/megengine/functional/math.py +++ b/imperative/python/megengine/functional/math.py @@ -631,11 +631,10 @@ def sort(inp: Tensor, descending: bool = False) -> Tuple[Tensor, Tensor]: return tns, ind -@deprecated_kwargs_default("1.12", "descending", 3) def topk( inp: Tensor, k: int, - descending: bool = False, + descending: bool = True, kth_only: bool = False, no_sort: bool = False, ) -> Tuple[Tensor, Tensor]: @@ -644,7 +643,7 @@ def topk( Args: inp: input tensor. If input tensor is 2d, each row will be sorted. 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 no_sort: if True, the returned elements can be unordered. Default: False -- GitLab