What good is torch.deserialize(torch.serialize(opt))

13 views
Skip to first unread message

JWG

unread,
Aug 2, 2017, 6:21:52 PM8/2/17
to torch7
What does this line of code accomplish:

local opt_clone = torch.deserialize(torch.serialize(opt))

It is from line 84 of
https://github.com/jcjohnson/torch-rnn/blob/master/train.lua

Daniel Galvez

unread,
Aug 3, 2017, 1:05:45 PM8/3/17
to torch7
It makes a copy of opt rather than a pointer that aliases the same instance that opt is pointing to.

Note that there are probably better ways to do that than this way.

JWG

unread,
Aug 7, 2017, 10:56:36 PM8/7/17
to torch7
On Thursday, August 3, 2017 at 1:05:45 PM UTC-4, Daniel Galvez wrote:
It makes a copy of opt rather than a pointer that aliases the same instance that opt is pointing to.
 
Good, that's what I suspected. 

Note that there are probably better ways to do that than this way.
 
Good, that's what I suspected.

Thanks
jwg
Reply all
Reply to author
Forward
0 new messages