Efficient Conditionally Invariant Representation Learning