Imported from https://github.com/LMA-NeurIPS19/LMA