Browse Source

create new directory when the specified directory is not found

nagadomi 8 years ago
parent
commit
3a70d09921
2 changed files with 5 additions and 0 deletions
  1. 3 0
      tools/benchmark.lua
  2. 2 0
      train.lua

+ 3 - 0
tools/benchmark.lua

@@ -77,6 +77,9 @@ to_bool(opt, "show_progress")
 if opt.thread > 0 then
    torch.setnumthreads(tonumber(opt.thread))
 end
+if opt.output_dir:len() > 0 then
+   dir.makepath(opt.output_dir)
+end
 
 local function rgb2y_matlab(x)
    local y = torch.Tensor(1, x:size(2), x:size(3)):zero()

+ 2 - 0
train.lua

@@ -301,6 +301,8 @@ local function train()
    else
       model = srcnn.create(settings.model, settings.backend, settings.color)
    end
+   dir.makepath(settings.model_dir)
+
    local offset = reconstruct.offset_size(model)
    local pairwise_func = function(x, is_validation, n)
       return transformer(model, x, is_validation, n, offset)