<story><title>NumPy 2.0</title><url>https://numpy.org/devdocs/release/2.0.0-notes.html</url></story><parent_chain><item><author>dahart</author><text>The thing I want most is a more sane and more memorable way to compose non-element-wise operations. There are so many different ways to build views and multiply arrays that I can’t remember them and never know which to use, and have to relearn them every time I use numpy… broadcasting, padding, repeating, slicing, stacking, transposing, outers, inners, dots of all sorts, and half the stack overflow answers lead to the most confusing pickaxe of all: einsum. Am I alone? I love numpy, but every time I reach for it I somehow get stuck for hours on what ought to be really simple indexing problems.</text></item></parent_chain><comment><author>salamo</author><text>When I started out I was basically stumbling around for code that worked. Things got a lot easier for me once I sat down and actually understood broadcasting.&lt;p&gt;The rules are: 1) scalars always broadcast, 2) if one vector has fewer dimensions, left pad it with 1s and 3) starting from the right, check dimension compatibility, where compatibility means the dimensions are equal or one of them is 1. Example: np.ones((2,3,1)) * np.ones((1,4)) = np.ones((2,3,4))&lt;p&gt;Once your dimensions are correct, it&amp;#x27;s a lot easier to reason your way through a problem, similar to how basic dimensional analysis in physics can verify your answer makes some sense.&lt;p&gt;(I would disable broadcasting if I could, since it has caused way too many silent bugs in my experience. JAX can, but I don&amp;#x27;t feel like learning another library to do this.)&lt;p&gt;Once I understood broadcasting, it was a lot easier to practice vectorizing basic algorithms.</text></comment>
<story><title>NumPy 2.0</title><url>https://numpy.org/devdocs/release/2.0.0-notes.html</url></story><parent_chain><item><author>dahart</author><text>The thing I want most is a more sane and more memorable way to compose non-element-wise operations. There are so many different ways to build views and multiply arrays that I can’t remember them and never know which to use, and have to relearn them every time I use numpy… broadcasting, padding, repeating, slicing, stacking, transposing, outers, inners, dots of all sorts, and half the stack overflow answers lead to the most confusing pickaxe of all: einsum. Am I alone? I love numpy, but every time I reach for it I somehow get stuck for hours on what ought to be really simple indexing problems.</text></item></parent_chain><comment><author>akasakahakada</author><text>To be honest einsum is the easiest one. You get fine control on which axis matmul to which. But I wish it can do more than matmul.&lt;p&gt;The others are just messy shit. Like you got np.abs but no arr.abs, np.unique but no arr.unique. But now you have arr.mean.&lt;p&gt;Sometimes you got argument name index, sometimes indices, sometimes accept (list, tuple), sometime only tuple.</text></comment>