Numpy’s fromfile()/tofile() make me smile — no typing or byte order metadata, they just write/read the raw bytes. A joyful API! I wish PyTorch had them natively on tensors, so I wasn’t doing so many tensor.cpu().numpy() operations.
Replying to @ID_AA_Carmack
Numpy one of the all time best apis ever created. Lightweight, fast, gets the job done

Sep 30, 2025 · 4:14 PM UTC

1
1
The only problem is that Numpy does not support operation fusion. Sure, you can multiple or add elements of two arrays together and underneath it will be done with vectorized instructions. But then it will return you a new array. And each subsequent operation will also return a new array. That means a lot of allocations and (what is more important) a lot of memory writes. It would be better if Numpy supported lazy evaluation of those operations and their fusion, so that all vectorized operations are processed in CPU registers and written to memory only at the very end.