GemmLayerImpl::initCUDA() called cv::transpose(B, B) on a shallow view of blobs[0]. When B is square (K == N) and transB is false, cv::transpose reuses the buffer in-place, mutating blobs[0] on the first forward() and transposing it back on a subsequent batch-size reshape. Transpose into a separate Mat before constructing InnerProductOp.