[Numpy-discussion] EHN: Discusions about 'add numpy.topk'
Daniele Nicolodi
daniele at grinta.net
Sat May 29 15:26:07 EDT 2021
On 29/05/2021 18:33, David Menéndez Hurtado wrote:
>
>
> On Sat, 29 May 2021, 4:29 pm Ralf Gommers, <ralf.gommers at gmail.com
> <mailto:ralf.gommers at gmail.com>> wrote:
>
>
>
> On Fri, May 28, 2021 at 4:58 PM <kangkai at mail.ustc.edu.cn
> <mailto:kangkai at mail.ustc.edu.cn>> wrote:
>
> Hi all,
>
> Finding topk elements is widely used in several fields, but
> missed in NumPy.
> I implement this functionality named as numpy.topk using core numpy
> functions and open a PR:
>
> https://github.com/numpy/numpy/pull/19117
> <https://github.com/numpy/numpy/pull/19117>
>
> Any discussion are welcome.
>
>
> Thanks for the proposal Kang. I think this functionality is indeed a
> fairly obvious gap in what Numpy offers, and would make sense to
> add. A detailed comparison with other libraries would be very
> helpful here. TensorFlow and JAX call this function `top_k`, while
> PyTorch, Dask and MXNet call it `topk`.
>
>
> When I saw `topk` I initially parsed it as "to pk", similar to the
> current `tolist`. I think `top_k` is more explicit and clear.
What does k stand for here? As someone that never encountered this
function before I find both names equally confusing. If I understand
what the function is supposed to be doing, I think largest() would be
much more descriptive.
Cheers,
Dan
More information about the NumPy-Discussion
mailing list