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.

A | B means either: reading union type hints in Python

Python · Type hints

def sensor_id(sensor: Sensor | int | None) -> int has three bars in one signature and looks like bit arithmetic. It is not arithmetic and it is not new syntax to memorise: each bar is the word or, and the whole annotation is one sentence — "a Sensor, or an int, or nothing".