bshillingford / python-torchfile

Deserialize Lua torch-serialized objects from Python
BSD 3-Clause "New" or "Revised" License
216 stars 25 forks source link

Can not read from t7 #15

Open Angel-Jia opened 6 years ago

Angel-Jia commented 6 years ago

I have created a file in lua:

local z = torch.Tensor(3,4,5)
torch.save('tmp.t7', z)

When I read it in python, I get nothing:

import torchfile
tmp = torchfile.load('tmp.t7')
print(type(output))
print(tmp)

output:

torch.Tensor
array([], dtype=float32)

I also tried from torch.utils.serialization import load_lua but I got the same result.

I have also tried torch.save('tmp.t7', {hello=123, world=torch.rand(1,2,3)}) but got {b'hello': 123, b'world': array([], dtype=float64)}

bshillingford commented 5 years ago

What is your OS, CPU architecture, and Python version?

FocusK commented 5 years ago

I have created a file in lua:

local z = torch.Tensor(3,4,5)
torch.save('tmp.t7', z)

When I read it in python, I get nothing:

import torchfile
tmp = torchfile.load('tmp.t7')
print(type(output))
print(tmp)

output:

torch.Tensor
array([], dtype=float32)

I also tried from torch.utils.serialization import load_lua but I got the same result.

I have also tried torch.save('tmp.t7', {hello=123, world=torch.rand(1,2,3)}) but got {b'hello': 123, b'world': array([], dtype=float64)}

FocusK commented 5 years ago

I have the same problem,can you tell me your solution?

hayden-donnelly commented 1 year ago

I'm having the same issue. Has anyone figured it out?