What happens here is that the addmm does have “overloads” to implement the behaviour that, as you correctly note, would not be possible using a single plain Python function.
The twist is that the one using keyword only alpha and beta arguments is the preferred one (defined in aten/src/ATen/native/native_functions.yaml 14) while the others are deprecated (defined in tools/autograd/deprecated.yaml 4).
It is, perhaps, unfortunate that the addmm example uses parameters that are marked as deprecated.
Best regards
Thomas
(who looked at this way too much when generating typehints  )