google-deepmind / google-deepmind/torch-hdf5
error in getting size of dataset
- Dominant language
- Lua
- Stars
- 241
- Forks
- 125
- PR merge metrics
- No merged PRs in 30d
Description
I have an hdf5 file with structure { data = { target=DoubleTensor - size: 1x1, sentence = DoubleTensor - size 6x8 } }
local testData = { sentence = torch.rand(4, 6), target = torch.rand(1,1)}
local writeFile = hdf5.open('/Users/ddua/Desktop/try.h5', 'w')
local options = hdf5.DataSetOptions()
options:setChunked(1,1)
options:setDeflate()
writeFile:write("data", testData, options)
writeFile:append("data", testData, options)
writeFile:close()
When I try to get the size of dataset
local dim = readFile:read("data"):dataspaceSize()
I get this error
attempt to call method 'dataspaceSize' (a nil value)
stack traceback:
[string "..."]:8: in main chunk
[C]: in function 'xpcall'
./itorch/main.lua:209: in function <./itorch/main.lua:173>
/Users/ddua/torch/install/share/lua/5.1/lzmq/poller.lua:75: in function 'poll'
/Users/ddua/torch/install/share/lua/5.1/lzmq/impl/loop.lua:307: in function 'poll'
/Users/ddua/torch/install/share/lua/5.1/lzmq/impl/loop.lua:325: in function 'sleep_ex'
/Users/ddua/torch/install/share/lua/5.1/lzmq/impl/loop.lua:370: in function 'start'
./itorch/main.lua:381: in main chunk
[C]: in function 'require'
(command line):1: in main chunk
[C]: at 0x01010bfbd0
Contributor guide
Research direction
Start with the dataset object returned by readFile:read("data") and inspect the available size-related API, since dataspaceSize() is nil in the reported call. Reproduce the example with the shown HDF5 structure and determine the supported way to obtain the dataset dimensions. Done means the documented or implemented call returns the expected size without the reported error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100