File size: 610 Bytes
e9fe176 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
local cjson = require 'cjson'
local pl = require 'pl.import_into'()
local utils = require 'fbcode.deeplearning.experimental.yuandong.utils.utils'
-- Save everything as a dictionary
local opt = pl.lapp[[
-i,--input (default "") Input t7 file
-o,--output (default "") Output json file
]]
-- print("Input file = " .. opt.input)
-- print("Output file = " .. opt.output)
t = utils.convert_to_table(torch.load(opt.input))
if debug then print("encoding json") end
s = cjson.encode(t)
-- s = pl.pretty.write(t)
f = assert(io.open(opt.output, "w"))
f:write(s)
-- save_to_json(t, f)
f:close()
|