unsqueeze

fun DTensor.unsqueeze(axis: Int): DTensor

Returns a new tensor with a dimension of size one inserted at the specified position of its shape.

Example:

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