1
0
Fork 0
mirror of synced 2024-05-17 03:12:18 +12:00

Fix to work on Lua52

web.lua does not work on Lua52 because turbo does not support Lua52 FFI.
This commit is contained in:
nagadomi 2017-03-02 14:47:49 +09:00
parent 780e22cf51
commit eb3926b61c
3 changed files with 12 additions and 2 deletions

View file

@ -1,5 +1,5 @@
-- snapply compression for ByteTensor
require 'snappy'
local snappy = require 'snappy'
local compression = {}
compression.compress = function (bt)
@ -9,7 +9,7 @@ end
compression.decompress = function(data)
local size = data[1]
local dec = snappy.decompress(data[2]:string())
local bt = torch.ByteTensor(unpack(torch.totable(size)))
local bt = torch.ByteTensor(table.unpack(torch.totable(size)))
bt:storage():string(dec)
return bt
end

View file

@ -148,4 +148,9 @@ end
settings.images = string.format("%s/images.t7", settings.data_dir)
settings.image_list = string.format("%s/image_list.txt", settings.data_dir)
-- patch for lua52
if not math.log10 then
math.log10 = function(x) return math.log(x, 10) end
end
return settings

View file

@ -81,6 +81,11 @@ if opt.output_dir:len() > 0 then
dir.makepath(opt.output_dir)
end
-- patch for lua52
if not math.log10 then
math.log10 = function(x) return math.log(x, 10) end
end
local function rgb2y_matlab(x)
local y = torch.Tensor(1, x:size(2), x:size(3)):zero()
x = iproc.byte2float(x)