Skip to main content
Log in

Mojo function

squeeze

squeeze(v: Symbol, axis: Int) -> Symbol

Removes a size-1 dimension from a symbolic tensor.

Args:

  • v (Symbol): The input symbolic tensor to squeeze.
  • axis (Int): The dimension to remove from the input's shape. If negative, this indexes from the end of the tensor. For example, squeeze(v, -1) squeezes the last dimension.

Returns:

A symbolic tensor with the same number of elements as the input tensor, and whose rank is 1 less than the rank of the input tensor.