diff --git a/aesara/tensor/basic_opt.py b/aesara/tensor/basic_opt.py index af758171d9..dc94ee078e 100644 --- a/aesara/tensor/basic_opt.py +++ b/aesara/tensor/basic_opt.py @@ -64,7 +64,6 @@ stack, switch, tensor_copy, - unbroadcast, zeros, zeros_like, ) @@ -151,26 +150,8 @@ def broadcast_like(value, template, fgraph, dtype=None): else: new_shape = template.shape rval = alloc(value, *new_shape) - # the template may have 1s in its shape without being broadcastable - if rval.broadcastable != template.broadcastable: - rval = unbroadcast( - rval, - *[ - i - for i in range(rval.ndim) - if rval.broadcastable[i] and not template.broadcastable[i] - ], - ) assert rval.type.dtype == dtype - if rval.type.broadcastable != template.broadcastable: - raise AssertionError( - "rval.type.broadcastable is " - + str(rval.type.broadcastable) - + " but template.broadcastable is" - + str(template.broadcastable) - ) - return rval