r/pytorch • • 21h ago

Tensor Golf - Master PyTorch tensor operations via focused drills

Post image
3 Upvotes

Hey everyone, I’ve just released Tensor Golf: a collection of focused PyTorch challenges for getting comfortable manipulating tensors.

I found that following ML tutorials and writing tensor code from scratch were two very different things. Understanding a model’s architecture doesn’t necessarily mean you can confidently reshape, broadcast, mask, or reduce its tensors.

Tensor Golf gives you an input tensor and a target output. Your job is to write the operations that transform one into the other.

The “golf” part is trying to solve problems in fewer operations, but the main goal is building fluency: recognising which operations fit a problem and understanding why they work.

There are currently many PyTorch problems all free on the platform, with some premium ones on the way to support the development of the platform :)

I'd love feedback from people learning or working with PyTorch.

link: https://tensor.golf


r/pytorch • • 8h ago

pytest-torch: PyTorch model-testing now made easier

Thumbnail
1 Upvotes

r/pytorch • • 13h ago

Differentiable simulations, one per sample, on the GPU, feeding PyTorch without writing them as tensors

Post image
0 Upvotes

Putting physics in a training loop often means running many small simulations that end at different times. Written as tensor code, every simulation keeps running until the last one finishes.

hawk lets you write the step for one sample as a typed Python function. It compiles it for the GPU and the CPU, and gives you its forward and reverse derivatives. eagle then runs a million of them and drops the ones that finish. The result plugs into torch.autograd, and tensors move to and from PyTorch without copies.

It is deliberately not a tensor framework: no layers, no training stack. PyTorch keeps doing that part. With a million samples in double precision that stop at different steps, the simulation part runs 9.8× to 130× faster than the same step written for torch.compile (130× on an H100, 11× on a free Colab T4), and 2.5× to 4.2× faster than an NVIDIA Warp kernel. JAX support is being certified for one of the next patch releases, and I have not benchmarked Triton yet.

Personal project; I work at ESA. There is a notebook that simulates, takes derivatives, and fits a drag coefficient with PyTorch: https://amasat01.github.io