Constrained Learning with Non-Convex Losses