Learning To Generalize Via Self-Supervised Prediction