squeeze

fun DTensor.squeeze(axis: Int): DTensor

Returns a tensor with the singleton dimension at the specified position of the shape removed.

Errors if the shape at the specified position is not 1.

Example:

val t = FloatTensor.ones(Shape(3, 1, 4)) t.squeeze(1) FloatTensor(Shape(3, 4), ...)