Allow specification of !=1
Type shape
#1104
Replies: 2 comments 5 replies
-
This touches on a more broad question of what type of information we want to carry at the Type level. Other examples include value domains (e.g., strictly positive, unit domain, semi-definite matrix, and so on), which when known allow for specific rewrites / simplification that could otherwise not be performed. E.g., #942 |
Beta Was this translation helpful? Give feedback.
-
The last part of this is not true, especially for the example in #1089. Theano had exactly the same underlying issues with compile-time broadcasting that we currently have, and it's because we're still using Theano's old broadcasting assumptions: i.e. we interpret The best one could say is that we want a consistent interpretation of What we actually did was allow
This is also a meaningless statement, because we are making the same broadcasting assumptions as Theano, and especially in the only places where it matters (e.g. the old rewrites and constructors that need broadcasting information). Why mention all this? We really need to understand why we want to add constraints like Here's one real reason for adding constraints: we want to correct the interpretation error mentioned above (i.e. the subject of #1170) and distinguish between unknown shapes (i.e. |
Beta Was this translation helpful? Give feedback.
-
Brought up in #1089
Knowing that two tensors will not broadcast (i.e., dimensions != 1) allows for more succinct graphs in some cases as well assumptions in rewrite. In fact many old rewrites developed in Theano relied on something like that (although it was a bit murky, see #1089 for more details), and are nowadays incorrect. Here is one known example in the codebase:
aesara/aesara/tensor/basic_opt.py
Lines 1695 to 1705 in 7f8af9b
A common pattern, is that when you have an Elemwise operation between two inputs, and they have the same broadcastable pattern, you can assume they have the same shape (otherwise it would be an invalid graph). With current Aesara Types you can not make this assumption because there is no way to specify
shape!=1
at the Type level, without specifying a specific shape.Beta Was this translation helpful? Give feedback.
All reactions