Stabilized training of joint energy-based models and their practical applications