What are the rules for comparing numpy arrays using ==?
问题 For example, trying to make sense of these results: >>> x array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) >>> (x == np.array([[1],[2]])).astype(np.float32) array([[ 0., 1., 0., 0., 0., 0., 0., 0., 0., 0.], [ 0., 0., 1., 0., 0., 0., 0., 0., 0., 0.]], dtype=float32) >>> (x == np.array([1,2])) False >>> (x == np.array([[1]])).astype(np.float32) array([[ 0., 1., 0., 0., 0., 0., 0., 0., 0., 0.]], dtype=float32) >>> (x == np.array([1])).astype(np.float32) array([ 0., 1., 0., 0., 0., 0., 0., 0., 0., 0.],