You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This requires re-introducing the broadcastable flags as independent from shape. It seems needed to:
Not force static shape to be unknown
Not change the meaning of the graph accidentally due to shape inference / rewrites
Affected Ops (anything that performs broadcasting of existing dims):
Elemwise
Alloc
GEMM Ops
Unbroadcast
Will require re-introducing Rebroadcast which could toggle broadcastable flags directly independently from static shape gains from SpecifyShape. Probably better named SpecifyBroadcastable.
Probably Elemwise outputs will have to be unbroadcastable as long as at least on input is also unbroadcastable along the same dimension.
An alternative is to make the broadcasting behavior, not a function of the static type of the Variables but of the Ops that do the implicit broadcasting. So Elemwise may have a broadcast_pattern with the indexes of the inputs that will be broadcasted along each dimension. That way if a graph replacement or a rewrite provides something with more defined static shape (1,) instead of the original (None,) the Op will not change it's behavior, and we no longer need this distinction at the type level.
The first time an Op is created, we would read it from the input static types, so everything works with backwards compatibility. This means however, that there would no longer be a single instance of non-unary Elemwises like pt.add, they would need to be created by the helper functions (or like we did for RVs with the dtype argument, with the __call__ method).
This makes sense to me as the same core operation with and without broadcasting are semantically quite different
Description
This requires re-introducing the broadcastable flags as independent from shape. It seems needed to:
Affected Ops (anything that performs broadcasting of existing dims):
Will require re-introducing
Rebroadcast
which could toggle broadcastable flags directly independently from static shape gains fromSpecifyShape
. Probably better namedSpecifyBroadcastable
.Probably Elemwise outputs will have to be unbroadcastable as long as at least on input is also unbroadcastable along the same dimension.
The text was updated successfully, but these errors were encountered: