func winograd(m, n, k int, mk, kn, mn []float32) { var ( w1 = make([]float32, m) w2 = make([]float32, n) ) for i1 := range w1 { var ( sum = float32(0) i3 = i1 * k last = i3 + k - 1 ) for ; i3 < last; i3 += 2 { sum -= mk[i3] * mk[i3+1] } w1[i1] = sum } for i2 := range w2 { var ( sum = float32(0) i4 = i2 last = len(kn) - n ) for ; i4 < last; i4 += 2 * n { sum -= kn[i4] * kn[i4+n] } w2[i2] = sum } for i1, w1 := range w1 { for i2, w2 := range w2 { var ( sum = w1 + w2 i3 = i1 * k last = i3 + k - 1 i4 = i2 ) for ; i3 < last; i3 += 2 { var ( x = mk[i3] + kn[i4+1] y = mk[i3+1] + kn[i4] ) sum += x * y i4 += 2 * n } if i3 == last { sum += mk[i3] * kn[i4] } mn[i1*n+i2] += sum } } }
To receive a hint, submit unfixed code.