Learning Robust Representations with Score Invariant Learning