async function topk(x, k) {
    const op = await TensorOpRegistry.top_k;

    if (k == null) {
        k = x.dims.at(-1);
    } else {
        k = Math.min(k, x.dims.at(-1));
    }
    return await op({
        x,
        k: new Tensor(
            'int64',
            [BigInt(k)],
            [1]
        )
    });
}
Returns the k largest elements of the given input tensor.
Inspired by https://pytorch.org/docs/stable/generated/torch.topk.html
@param {Tensor} x the input tensor
@param {number} [k] the k in "top-k"
@returns {Promise<[Tensor, Tensor]>} the output tuple of (Tensor, LongTensor) of top-k elements and their indices.