TopK

Description

Returns the k maximum or minimum values of a specified axis.

Input

  • ONNX version: Opset < 10

    One input:

    x: tensor of type float16 or float.

  • ONNX version: Opset >= 10

    Two inputs:

    x: tensor of type float16 or float.

    k: tensor of type int64.

Output

Two outputs:

Values: return value of topk.

Indices: index of the top K return value.

Attribute

axis: int. Defaults to -1.

largest: int. Defaults to 1, indicating that k maximum/minimum values are returned.

sorted: int. Whether to sort in ascending order. Defaults to 1.

ONNX Opset Support

Opset v8/v9/v10/v11/v12/v13/v14/v15/v16/v17/v18