---
title: "topk"
sidebar_label: "topk"
description: "Kotlin binding reference: topk."
---

<!-- Generated by tools/api_reference/generate_api_docs.py. Do not edit. -->

//[clika-runtime](../../../index.md)/[io.clika.runtime](../index.md)/[Ops](index.md)/[topk](topk.md)

# topk

[common]\
fun [topk](topk.md)(input: [Tensor](../Tensor/index.md), k: [Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html), dim: [Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html) = -1L, largest: [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) = true, sorted: [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) = true): [List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)&lt;[Tensor](../Tensor/index.md)&gt;

`topk(input: Tensor, k: Long, dim: Long = -1L, largest: Boolean = true, sorted: Boolean = true)`: the `topk` operator.