Looking at the source code here 11, and to this issue 4, I realize that what I need is to get the flattened indices – the indices ONNX returns.
With this in hand I will be able to use bincount as I intended.