Imported from https://github.com/GokuMohandas/fast-weights