def _can_broadcast(shape1, shape2):
  """Whether two shapes can broadcast together using numpy rules"""
  for i, j in zip(reversed(shape1), reversed(shape2)):
    if i != j and i != 1 and j != 1:
      return False
  return True