def test_save_sup_load_rl(self): pass model_to_save = MockModel(spinn.pyramid.Pyramid, default_args()) opt_to_save = optim.SGD(model_to_save.parameters(), lr=0.1) trainer_to_save = ModelTrainer(model_to_save, opt_to_save) model_to_load = MockModel(spinn.pyramid.Pyramid, default_args()) opt_to_load = optim.SGD(model_to_load.parameters(), lr=0.1) trainer_to_load = ModelTrainer(model_to_load, opt_to_load) # Save to and load from temporary file. temp = tempfile.NamedTemporaryFile() trainer_to_save.save(temp.name, 0, 0) trainer_to_load.load(temp.name) compare_models(model_to_save, model_to_load) # Cleanup temporary file. temp.close()
def test_save_sup_load_rl(self): scalar = 11 other_scalar = 0 model_to_save = MockModel(spinn.fat_stack.BaseModel, default_args()) opt_to_save = optim.SGD(model_to_save.parameters(), lr=0.1) trainer_to_save = ModelTrainer(model_to_save, opt_to_save) model_to_load = MockModel(spinn.rl_spinn.BaseModel, default_args()) opt_to_load = optim.SGD(model_to_load.parameters(), lr=0.1) trainer_to_load = ModelTrainer(model_to_load, opt_to_load) # Save to and load from temporary file. temp = tempfile.NamedTemporaryFile() trainer_to_save.save(temp.name, 0, 0) trainer_to_load.load(temp.name) compare_models(model_to_save, model_to_load) # Cleanup temporary file. temp.close()