Skip to main content
Log in

Mojo function

reshape_like

reshape_like(v: Symbol, like: Symbol) -> Symbol

Reshapes a symbolic tensor to the same shape as another symbolic tensor.

The number and order of the elements in the tensor is unchanged. In other words, if you were to iterate over elements in the tensor by major dimension to minor dimension, the iteration order would stay the same.

Args:

  • v (Symbol): The input symbolic tensor to reshape.
  • like (Symbol): A symbolic tensor whose shape should be used as the reshape.

Returns:

A symbolic tensor with the same elements as the original tensor, but in a new shape. The shape of the new tensor is the same as the shape of the like tensor.