Loading tensors saved in PyTorch in Torch?

Hi guys

New to PyTorch, it’s cool, I like it. However, I have a tensor I’ve saved, as follows:

finalTensor = torch.from_numpy(apiTensor)
torch.save(finalTensor, ‘finalTensor.stu’)

It saves, and loads, in PyTorch fine.

Problem is when I try and load it in (Lua)Torch like this:

apiCallsFile = ‘some/path/to/finalTensor.stu’
local rawAPICalls = torch.load(apiCallsFile)

I get this error:

/home/smillar/torch/install/bin/luajit: /home/smillar/torch/install/share/lua/5.1/torch/File.lua:375: unknown object
stack traceback:
[C]: in function ‘error’
/home/smillar/torch/install/share/lua/5.1/torch/File.lua:375: in function ‘readObject’
/home/smillar/torch/install/share/lua/5.1/torch/File.lua:409: in function ‘load’
./prepareAPICallsEmbedding.lua:70: in function ‘prepareAPICallsEmbedding’
DetectMalware_CNN.lua:269: in main chunk
[C]: in function ‘dofile’
…llar/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: at 0x00405d50

I suspect the pickling when saving in PyTorch has something to do with it. And the path for ‘apiCallsFile’ is correct.

Is there any way to do this?




I’m afraid there is no way to load it from Torch7. The saving uses python’s pickle module.