What is the best way to test whether an array can be broadcast to a given shape?
The \"pythonic\" approach of trying doesn\'t work for my case, because the
try
I really think you guys are over thinking this, why not just keep it simple?
def is_broadcastable(shp1, shp2): for a, b in zip(shp1[::-1], shp2[::-1]): if a == 1 or b == 1 or a == b: pass else: return False return True