I would expect the output to be of shape (3, 5) but with junk values for the out of bound elements.
jnp.reshape of a dynamically-shaped array with new dynamic shape results in a segfault during compilation. Lowering to MLIR seems to happen correctly, but we suspect that mhlo.dynamic_reshape doesn't have a lowering rule.
It turns out that there are several bugs involved in attempting to reshape dynamic shaped arrays. In particular:
jnp.reshape
of a dynamically-shaped array with new compile-time shape results in the array being returned without any change in shape:I would expect the output to be of shape
(3, 5)
but with junk values for the out of bound elements.jnp.reshape
of a dynamically-shaped array with new dynamic shape results in a segfault during compilation. Lowering to MLIR seems to happen correctly, but we suspect thatmhlo.dynamic_reshape
doesn't have a lowering rule.jnp.reshape
of a dynamically-shaped array within a loop iteration leads to a cryptic error even before compilation:_Originally posted by @josh146 in https://github.com/PennyLaneAI/catalyst/pull/904#discussion_r1667077464_