Gradient descent in materia through homodyne gradient extraction