News for hackers. Stuff that matters.
Re:I Don't Like NumPy by ddtaylor on Thursday May 15, 2025 @04:20PM (#43998923)
Is there anything similar to this for something like Tensorflow, Keras or Pytorch? I haven't used them super recently, but in the past I needed to do all of the things you just described in painful to debug ways.
Re:I Don't Like NumPy by mgunyho on Thursday May 15, 2025 @04:23PM (#43998938)
For Torch, I have come across Named Tensors, which should work in a similar way: https://docs.pytorch.org/docs/stable/named_tensor.html

The docs say that it's a prototype feature, and I think it has been that way for a few years now, so no idea how production-ready it is.

Re:I Don't Like NumPy by xiphias2 on Thursday May 15, 2025 @05:16PM (#43999421)
It's a much worse API than Xarrays, it seems like somebody should build it on top of PyTorch.
Re:I Don't Like NumPy by SimplyUnknown on Thursday May 15, 2025 @04:55PM (#43999255)
I really like einops. This works for numpy, pytorch and keras/tensorflow and has easy named transpose, repeat, and eimsum operations.
Re:I Don't Like NumPy by rsfern on Thursday May 15, 2025 @08:12PM (#44000605)
Same - I’ve been using einops and jaxtyping together pretty extensively recently and it helps a lot for reading/writing multidimensional array code. Also array_api_compat, the API coverage isn’t perfect but it’s pretty satisfying to write code that works for both PyTorch and numpy arrays

https://docs.kidger.site/jaxtyping/

https://data-apis.org/array-api-compat/

Re:I Don't Like NumPy by toth on Thursday May 15, 2025 @04:25PM (#43998955)
For pytorch the analogue is Named Tensors, but it's a provisional feature and not supported everywhere.

https://docs.pytorch.org/docs/stable/named_tensor.html