pytensor
pytensor copied to clipboard
`SpecifyShape` should eagerly raise an error when static shapes disagree
Description
This came up in #885. The following graph will raise at compile time, but not during graph construction:
x = tensor("x", shape=(None, 5, 3))
# We avoid the helper specify_shape that optimizes some (but not all) cases eagerly
ss = SpecifyShape()
out = ss(x, None, 5, 4)
This should just raise immediately, since x
has a static shape 3
on the 3rd dimension, and we're trying to specify a shape of 4
.