reshape

Function reshape 

Source
pub fn reshape(old_shape: &[usize], new_shape: &[isize]) -> Result<Shape>
Expand description

Reshapes a tensor shape, validating that total elements match.

Supports -1 in one dimension to infer the size.

§Arguments

  • old_shape - Current shape
  • new_shape - Target shape (can contain -1)

§Returns

Resolved shape, or error if incompatible.