We present a smooth version of Sylvester's law of inertia for symmetric matrix functions of constant rank. The techniques used in the proof are constructive but the resulting numerical approaches are unstable and therefore require stabilization. Two different stabilization techniques are suggested, one based on a descent method and one based on Newton's method. We include some numerical tests to demonstrate the applicability of the obtained numerical methods.