Welcome to mirror list, hosted at ThFree Co, Russian Federation.

serialize.lua - github.com/torch/threads-ffi.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f820bc05a65715e688cde5777ba725efd74adfb0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
require 'torch'

local serialize = {}

function serialize.save(func)
   local f = torch.MemoryFile()
   f:binary()
   f:writeObject(func)
   local storage = f:storage()
   f:close()
   return storage
end

function serialize.load(storage)
   local f = torch.MemoryFile(storage)
   f:binary()
   local func = f:readObject()
   f:close()
   return func
end

return serialize