Should shape graphs assume inputs are valid? #371
ricardoV94
started this conversation in
General
Replies: 1 comment
-
We would add a config flag |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
According to the documentation: infer_shape implementations do not generally assert the inputs are valid: https://pytensor.readthedocs.io/en/latest/tutorial/shape_info.html#problems-with-shape-inference
This was the case in the times of Theano, and they mention Elemwise specifically.
In Aesara, the
Elemwise.infer_shape
was eventually modified to validate shape information when we moved towards dynamic broadcasting (see brandonwillard/aesara@064e72f)Although the two issues need not be related, the implementation logic changes depending which view we want to take.
This is how the optimized compiled graph for an addition shape looks like:
This issue cropped up in the implementation of
AdvancedSubtensor.infer_shape
, which originally did not support the boolean index case because of this? aesara-devs/aesara#39In that case the argument against boolean index in particular didn't seem relevant, because advanced integer indexing can also be invalid:
But it touches on the very same question!
Originally posted by @ricardoV94 in #329 (comment)
Beta Was this translation helpful? Give feedback.
All reactions