| 15 | |
| 16 | namespace { |
| 17 | void shape_abc(const TensorShape& shape, size_t axis, size_t& A, size_t& B, size_t& C) { |
| 18 | auto acc_mul = [](const size_t* first, const size_t* last) { |
| 19 | return std::accumulate(first, last, 1u, std::multiplies<size_t>()); |
| 20 | }; |
| 21 | A = acc_mul(shape.shape, shape.shape + axis); |
| 22 | B = shape.shape[axis]; |
| 23 | C = acc_mul(shape.shape + axis + 1, shape.shape + shape.ndim); |
| 24 | } |
| 25 | |
| 26 | void argsort_data_gen(HostTensorND& dest) { |
| 27 | mgb_assert(dest.layout().ndim == 2 && dest.layout().is_contiguous()); |