-
Notifications
You must be signed in to change notification settings - Fork 357
Closed
Description
In addition to the limits of into_shape() described in #390, I think the following is a bug with the current implementation.
I'm trying to reshape a tensor into its own shape (which should obviously always succeed).
let array = Array:from_shape_vec((224, 224, 3), vec![...])?;
let array = array.permuted_axes([2, 0, 1]);
let shape = array.shape().to_owned(); // [3, 224, 224]
let array = array.into_shape(shape)?; // This should not fail.
// Err(ShapeError/IncompatibleLayout: incompatible memory layout)This use case is purely hypothetical (why would anyone want to reshape into the current shape?), but I still think it might be a bug.
The next step would be to support reshaping from (A...) to (1, A...), which I assume would also be possible once this bug is fixed.
let array = Array:from_shape_vec((224, 224, 3), vec![...])?;
let array = array.permuted_axes([2, 0, 1]);
let array = array.into_shape([1, 3, 224, 224])?; // This should not fail.
// Err(ShapeError/IncompatibleLayout: incompatible memory layout)Metadata
Metadata
Assignees
Labels
No labels