array_utils.h
¶
Functions
-
static inline std::vector<std::size_t> get_normalized_axes(const std::variant<nb::tuple, nb::int_> &axes, const std::size_t n_dim)¶
Converts the provided axes into a vector of positive indices.
- Throws:
nb::value_error – if an axis value is out of bounds, if there are duplicate axes in the tuple or the axis don’t match.
-
template<typename RANDOM_ACCESS_CONST_ITERATOR, typename RANDOM_ACCESS_ITERATOR>
static inline void transpose_axes_and_copy_data(RANDOM_ACCESS_CONST_ITERATOR src, RANDOM_ACCESS_ITERATOR dst, const std::vector<std::size_t> &src_shape, const std::vector<std::size_t> &new_axis, std::size_t itemsize = 1)¶ Permutes the dimensions of the input data and copies it to the destination.
This function permutes the dimensions of the source data according to the provided permutation array and copies the permuted data to the destination. Assumunes that the sizes specified in src_shape and perm match the dimensionality of the data.