sumNdStrided

Undocumented in source. Be warned that the author may not have intended to support it.
void
sumNdStrided
(
size_t d = 0
S
D
size_t dim
)
(
S src
,
D dst
,
ptrdiff_t[dim] strides...
)
if (
isSlice!S &&
isSlice!D
&&
)

Examples

import numir;
import mir.ndslice;

auto s = iota(3, 4);
auto t = s.ndStrided(2, 3); // [[[[1, 2, 2]], [[4, 5, 5]]], [[[7, 8, 8]], [[10, 11, 11]]]]
auto d = s.slice.zeros_like;
sumNdStrided(s.ndStrided(2, 3).slice, d, [2, 3]);
assert(d == [[22, 0, 0, 14], [0, 0, 0, 0], [19, 0, 0, 11]]);

Meta