Slice to copy shape and data from (optional).
n-dimensional slice
import mir.ndslice.slice: Slice; import mir.rc.array: RCI; auto tensor = rcslice!int(5, 6, 7); assert(tensor.length == 5); assert(tensor.elementCount == 5 * 6 * 7); static assert(is(typeof(tensor) == Slice!(RCI!int, 3))); // creates duplicate using `rcslice` auto dup = tensor.rcslice; assert(dup == tensor);
import mir.ndslice.slice: Slice; import mir.rc.array: RCI; auto tensor = rcslice([2, 3], 5); assert(tensor.elementCount == 2 * 3); assert(tensor[1, 1] == 5); import mir.rc.array; static assert(is(typeof(tensor) == Slice!(RCI!int, 2)));
import mir.rc.array: RCI; import mir.ndslice.slice: Slice; import mir.ndslice.topology : iota; import mir.ndslice.concatenation; auto tensor = concatenation([2, 3].iota, [3].iota(6)).rcslice; assert(tensor == [3, 3].iota); static assert(is(typeof(tensor) == Slice!(RCI!ptrdiff_t, 2)));
Allocates an n-dimensional reference-counted (thread-safe) slice.