NaN is not one bit pattern: sorting floats by integer keys

Floats · sorting · NaN

float("nan") and 0/0 both print as nan, but they are not always the same bits. A sort that never compares the floats, and instead ranks an integer key made from those bits, can give those NaNs a rank against each other. That breaks a stable rule: equal values keep the earlier column. Fold every NaN to one bit pattern before the key is built.

marearts-tinydeform: deformable attention in one CUDA call

Open source · CUDA · PyTorch

marearts-tinydeform is our first open-source CUDA kernel. It runs the value projection and multi-scale deformable attention of a DETR-style decoder (RT-DETR, D-FINE, DINO, Deformable-DETR) as one call, gives the same result as the usual PyTorch code, and is up to 4.7× faster than the original Deformable-DETR CUDA op when there are few queries. Apache-2.0, free for any use.

unittest.mock, from stand-ins to spies

Python · Testing

A mock is a stand-in you put where a real function or object used to be, for as long as a test runs. It answers the way you tell it to, it remembers every call it got, and when the test ends the original comes back. This guide covers both halves — controlling and recording — and then the part most tutorials skip: wraps=, a spy that lets the real code run.