flatten

fun DTensor.flatten(): DTensor

Flattens a tensor into a vector (a tensor with rank 1).


fun DTensor.flatten(startDim: Int = 0, endDim: Int = rank - 1): DTensor

Returns a tensor with dimensions startDim, endDim (inclusive range) flattened.

If startDim is greater than endDim, returns the input tensor.