Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
fix recordio
Browse files Browse the repository at this point in the history
  • Loading branch information
piiswrong committed Dec 23, 2016
1 parent 7051180 commit a25f139
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions python/mxnet/recordio.py
Expand Up @@ -59,6 +59,7 @@ def close(self):
check_call(_LIB.MXRecordIOWriterFree(self.handle))
else:
check_call(_LIB.MXRecordIOReaderFree(self.handle))
self.is_open = False

def reset(self):
"""Reset pointer to first item. If record is opened with 'w',
Expand Down Expand Up @@ -135,6 +136,8 @@ def open(self):
self.keys.append(key)

def close(self):
if not self.is_open:
return
super(MXIndexedRecordIO, self).close()
self.fidx.close()

Expand Down
2 changes: 2 additions & 0 deletions src/c_api/c_api.cc
Expand Up @@ -723,6 +723,7 @@ int MXRecordIOWriterFree(RecordIOHandle handle) {
reinterpret_cast<MXRecordIOContext*>(handle);
delete context->writer;
delete context->stream;
delete context;
API_END();
}

Expand Down Expand Up @@ -763,6 +764,7 @@ int MXRecordIOReaderFree(RecordIOHandle handle) {
delete context->reader;
delete context->stream;
delete context->read_buff;
delete context;
API_END();
}

Expand Down

0 comments on commit a25f139

Please sign in to comment.