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.
29
15
789
Replies
@ID_AA_Carmack Someone from @PyTorch should read this and make it happen, safe to say we’d all love it!
0
0
3
@ID_AA_Carmack If Python does something I need I will at once rewrite it in C. I have a little side project I call NumC. Rewrite everything Numpy in C. Grok makes this cheesy easy now.
3
0
11
@ID_AA_Carmack Direct tensor I/O would be huge, especially for fast checkpoints and interop with non python systems. Surprising PyTorch hasn’t baked in raw binary read/write yet.
0
0
10
@ID_AA_Carmack But you can use dtype argument to set its type and control endianness by prepending either ‘<‘ or ‘>’ to a type string: numpy.fromfile(path, dtype=‘>i4’)
0
0
5
@ID_AA_Carmack Sometimes the simplest APIs are the most powerful and NumPy proves it every time. PyTorch could learn something here about not overengineering basic file operations.
0
0
3
@ID_AA_Carmack Numpy one of the all time best apis ever created. Lightweight, fast, gets the job done
1
0
1
@ID_AA_Carmack The leap from strong types to "here's some data of some type" is jarring for me. I always feel like I end up negating the prototype speed with having to compensate for ambiguous types. I'm not saying I want to have main() entirely comprised of pointer logic, but Python irks me.
0
0
1
@ID_AA_Carmack numpy sounds like grumpy. My man child woke up grumpy this morning. Its cute Mr. Carmack.
1
0
0
@ID_AA_Carmack There is this graphics library called Cairo that can export raw pixel data. You can feed a sequence of images to stdout, pipe that output into ffmeg, and tell it the format of the data, to turn it into a compressed video that you can play anywhere
0
0
0
@ID_AA_Carmack Maybe ask Claude 4.5 to do a PR on tensors @ID_AA_Carmack If your lucky, it might just work :)
0
0
0
@ID_AA_Carmack Hi John, we are putting on our second Game AI conference in Atlanta Feb. 21-22, 2026. Last year Luke Dicken, head of AI for Take-Two, was our industry keynote ( https://t.co/MrvgWfO8xc). Can we talk about what would be involved in having you as a speaker? president@ggda.org
0
0
0
@ID_AA_Carmack numpy is awesome, I wrote 90% of the code for my thesis with it, together with opengl python bindings, and a few C libraries for performance oriented code...never going back 😁
0
0
0
@ID_AA_Carmack @__tinygrad__ lets you do raw byte tensors: Tensor(Path("weights.bin"), dtype=dtypes.float32) keeps the file as storage; https://t.co/GnID6s1XC0() gives the bytes; t.assign(...) overwrites in place.
0
0
0