You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
np.matmul on QuadPrecision arrays returns incorrect results whenever the inputs have leading (broadcast/batch) dimensions larger than 1. Only the first batch is computed; every subsequent output cell comes back as zero.
In src/csrc/umath/matmul.cpp all three strided-loop functions capture N = dimensions[0] (the outer broadcast
loop length) but never iterate over it.
They also never advance the A, B, C pointers by their batch strides. As a result, batch 0 is computed correctly.
The single memset zeroes the whole output once at the start, so batches 1..N-1 just stay zero.
My misunderstanding also left an misleading comment // Batch size, this remains always 1 for matmul afaik
changed the title [-][BUG] `matmul` produces incorrect results for batched / N-D inputs (leading dim > 1)[/-][+][BUG] `matmul` produces incorrect results for batched / N-D inputs[/+]on May 11, 2026
Activity
[-][BUG] `matmul` produces incorrect results for batched / N-D inputs (leading dim > 1)[/-][+][BUG] `matmul` produces incorrect results for batched / N-D inputs[/+]