func gradient(y, dx, dy []float64) { pre := float64(0) for i, y := range y { pre += y * dy[i] } for i, y := range y { sum := pre + dy[i] dx[i] = sum * y } }
To receive a hint, submit unfixed code.