vt::reduce#
-
template<typename T, typename U, size_t N, typename KernelFunc>
Tensor<T, N - 1> vt::reduce_along_axis(const Tensor<U, N> &tensor, int axis, KernelFunc kernel_func)# Reduce the tensor along the given axis. The method swaps the axis to the last dimension, and performs the reduction along the last axis.
- Template Parameters:
T – The data type of the result tensor.
U – The data type of the input tensor.
N – Number of dimensions of the tensor.
KernelFunc – The kernel function to reduce the tensor.
- Parameters:
tensor – The tensor object.
axis – The axis to reduce.
kernel_func – The kernel function to reduce the tensor.
- Returns:
Tensor<T, N-1>: The results tensor.