pytensor icon indicating copy to clipboard operation
pytensor copied to clipboard

`SpecifyShape` should eagerly raise an error when static shapes disagree

Open jessegrabowski opened this issue 7 months ago • 0 comments

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.

jessegrabowski avatar Jul 06 '24 17:07 jessegrabowski