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
importpytensor.tensorasptx=pt.vector("x")
pt.squeeze(x, axis=0)
# ValueError: Cannot drop a non-broadcastable dimension: [False], []
The user provided us information that this dimension will be of length 1, so we could add a specify_broadcastable and only then call squeeze. I think this behavior is more intuitive, and I don't see any drawbacks.
This can only be done when the user provides specific axis, not when axis=None
pt.squeeze(pt.specify_broadcastable(x, 0), axis=0).eval({x: [0]})
# array(0.)pt.squeeze(pt.specify_broadcastable(x, 0), axis=0).eval({x: [0, 1, 2]})
# AssertionError: SpecifyShape: dim 0 of input has shape 3, expected 1.
The text was updated successfully, but these errors were encountered:
Description
The following snippet fails:
The user provided us information that this dimension will be of length 1, so we could add a
specify_broadcastable
and only then callsqueeze
. I think this behavior is more intuitive, and I don't see any drawbacks.This can only be done when the user provides specific axis, not when axis=None
The text was updated successfully, but these errors were encountered: