Summary
The demo uses RaggedBatch to represent samples with different numbers
of objects. This allows cost matrices and losses to be computed in batches while tracking which entries
belong to each sample.
The matching tutorial explains batched cost-matrix construction; the Hungarian assignment itself still runs per sample on the CPU. The loss tutorials show how to handle the sample and camera dimensions in the Focal head and the additional decoder-layer dimension in the StreamPETR head.
See the Evaluation for the measured gains, the changes shared by the baseline and optimized implementations, and commands for running the comparison.