Skip to content

Commit

Permalink
fix: HDF5File.__init() requires a fileID
Browse files Browse the repository at this point in the history
The constructor wants a "number" so we convert to it.
Issue google-deepmind#81
  • Loading branch information
adynathos committed Jun 6, 2018
1 parent 969ec7c commit 539fc15
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions luasrc/file.lua
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,12 @@ function hdf5.HDF5File.open(filename, mode)
end
local function createFunc(filename, access)
local fileID = hdf5.C.H5Fcreate(filename, access, hdf5.H5P_DEFAULT, hdf5.H5P_DEFAULT)
fileID = tonumber(fileID) --HDF5File:__init wants a "number"
return hdf5.HDF5File(filename, fileID)
end
local function openFunc(filename, access)
local fileID = hdf5.C.H5Fopen(filename, access, hdf5.H5P_DEFAULT)
fileID = tonumber(fileID) --HDF5File:__init wants a "number"
return hdf5.HDF5File(filename, fileID)
end
if mode == 'r' then
Expand Down
2 changes: 1 addition & 1 deletion luasrc/group.lua
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function HDF5Group.__read(object, self, versionNumber)
end

function HDF5Group:__tostring()
return "[HDF5Group " .. self._groupID .. " " .. hdf5._getObjectName(self._groupID) .. "]"
return "[HDF5Group " .. tostring(self._groupID) .. " " .. hdf5._getObjectName(self._groupID) .. "]"
end

function HDF5Group:_writeDataSet(locationID, name, tensor, options)
Expand Down

0 comments on commit 539fc15

Please sign in to comment.