For example, trying to understand 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.], dtype=float32) >>> (x == np.array([[1,3],[2]])) False >>>
What's going on here? In the case of [1], it compares 1 with each element x and aggregates the result in an array. In the case of [[1]] the same. Itβs easy to understand what will happen for specific array forms by simply experimenting with repl. But what are the basic rules in which both sides can have arbitrary forms?