mirror of
https://github.com/opencv/opencv.git
synced 2026-11-23 17:57:56 -06:00
MatMulHelper::updatePackedBOffsets derived the per-slice stride of the packed constant weight as packed_B_size / batch, where `batch` is the number of matrices in the *output*, i.e. after broadcasting the batch dims. fastGemmPackB stores one packed matrix per batch slice actually present in B, so when B is broadcast over the output batch dims the two counts differ and every slice beyond the first was read at the wrong offset. The output had the correct shape but wrong values: only the first index along a broadcast dim matched. Remember the number of slices stored in B (B_batch) in compute() and use it to derive the packed stride. Add a regression test using A(2,1,3,4) @ B(1,5,4,6); it fails before the fix and passes after.