docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method TopK

    TopK(TensorFloat, TensorFloat, TensorInt, int, int, bool)

    Calculates the top-K largest or smallest elements of an input tensor along a given axis.

    Declaration
    void TopK(TensorFloat X, TensorFloat values, TensorInt indices, int k, int axis, bool largest)
    Parameters
    Type Name Description
    TensorFloat X

    The input tensor.

    TensorFloat values

    The output tensor to be computed and filled with the top K values from the input tensor.

    TensorInt indices

    The output tensor to be computed and filled with the corresponding input tensor indices for the top K values from the input tensor.

    int k

    The number of elements to calculate.

    int axis

    The axis along which to perform the top-K operation.

    bool largest

    Whether to calculate the top-K largest elements. If this is false, the layer calculates the top-K smallest elements.

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)