1
0
Fork 0
mirror of synced 2024-05-16 10:52:20 +12:00

Fix clearState

This commit is contained in:
nagadomi 2017-04-13 17:38:18 +09:00
parent b7e116de54
commit 063474b2ea

View file

@ -543,8 +543,9 @@ local function train()
best_score = score_for_update
print("* model has updated")
if settings.save_history then
torch.save(settings.model_file_best, model:clearState(), "ascii")
torch.save(string.format(settings.model_file, epoch, i), model:clearState(), "ascii")
pmodel:clearState()
torch.save(settings.model_file_best, model, "ascii")
torch.save(string.format(settings.model_file, epoch, i), model, "ascii")
if settings.method == "noise" then
local log = path.join(settings.model_dir,
("noise%d_best.%d-%d.png"):format(settings.noise_level,
@ -568,7 +569,8 @@ local function train()
save_test_user(model, test_image, log)
end
else
torch.save(settings.model_file, model:clearState(), "ascii")
pmodel:clearState()
torch.save(settings.model_file, model, "ascii")
if settings.method == "noise" then
local log = path.join(settings.model_dir,
("noise%d_best.png"):format(settings.noise_level))