stack

fun DTensor.stack(right: DTensor, axis: Int = 0): DTensor

Stack two tensors along the provided new axis.

The shape of the inputs must match exactly. The shape of the result is the same as those of the inputs, except with a new axis inserted, where it is the of inputs stacked together.

Example: val x = tensorOf(listOf(3, 6, 5), { ... }) val y = tensorOf(listOf(3, 6, 5), { ... }) x.stack(y, axis = 1) // dimensions are (3, 2, 6, 5)


fun stack(slices: List<DTensor>, axis: Int = 0): DTensor