diff --git a/hir/src/ops/array/reshape.rs b/hir/src/ops/array/reshape.rs index a57cc00252..2309499773 100644 --- a/hir/src/ops/array/reshape.rs +++ b/hir/src/ops/array/reshape.rs @@ -23,7 +23,8 @@ impl Expansion for Reshape { s.given_2(&inputs[0].shape, &inputs[1].value, move |s, ishape, shape| { let shape = shape.cast_to::()?; let shape = shape.as_slice::()?; - let oshape = compute_shape(&ishape, &shape)?; + let oshape = compute_shape(&ishape, &shape) + .with_context(|| format!("Reshaping {:?} to {:?}", ishape, shape))?; s.equals(&outputs[0].shape, ShapeFactoid::from(oshape)) }) } @@ -63,7 +64,7 @@ fn compute_shape(input: &[TDim], shape_spec: &[TDim]) -> TractResult> } if *slot == 0.into() { if remaining_dim_input != TDim::one() { - bail!("Invalid"); + bail!("Invalid remaining dim"); } *slot = input_dims.peek().context("Invalid")?.clone().clone(); }