Fix to work on Lua52
web.lua does not work on Lua52 because turbo does not support Lua52 FFI.
This commit is contained in:
parent
780e22cf51
commit
eb3926b61c
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue