Find top k elements along a given dimension This function returns the top k values along a given dimension of the input array. The indices along with their values are returned. If the input is a multi-dimensional array, the indices will be the index of the value in that dimension. Order of duplicate values are not preserved. This function is optimized for small values of k. Currently, topk elem
(input: &Array<T>, k: u32, dim: i32, order: TopkFn)
| 478 | /// with the second Array containing the indices of the topk values in the input |
| 479 | /// data. |
| 480 | pub fn topk<T>(input: &Array<T>, k: u32, dim: i32, order: TopkFn) -> (Array<T>, Array<u32>) |
| 481 | where |
| 482 | T: HasAfEnum, |
| 483 | { |
| 484 | unsafe { |
| 485 | let mut t0: af_array = std::ptr::null_mut(); |
| 486 | let mut t1: af_array = std::ptr::null_mut(); |
| 487 | let err_val = af_topk( |
| 488 | &mut t0 as *mut af_array, |
| 489 | &mut t1 as *mut af_array, |
| 490 | input.get(), |
| 491 | k as c_int, |
| 492 | dim as c_int, |
| 493 | order as c_uint, |
| 494 | ); |
| 495 | HANDLE_ERROR(AfError::from(err_val)); |
| 496 | (t0.into(), t1.into()) |
| 497 | } |
| 498 | } |
| 499 | |
| 500 | /// Calculate mean and variance in single API call |
| 501 | /// |
nothing calls this directly
no test coverage detected