提交 8bffa4a7 编写于 作者: G gongweibao

fix bugs

上级 dbfe58ca
...@@ -57,15 +57,17 @@ def text_file(path): ...@@ -57,15 +57,17 @@ def text_file(path):
return reader return reader
def RecordIO(path): def recordio(path):
""" """
Creates a data reader that outputs record one one by one from given recordio file Creates a data reader that outputs record one one by one from given recordio file
:path: path of recordio file :path: path of recordio file
:returns: data reader of recordio file :returns: data reader of recordio file
""" """
import recordio as rec
def reader(): def reader():
f = recordio.reader(path) f = rec.reader(path)
while True: while True:
r = f.read() r = f.read()
if r is None: if r is None:
......
...@@ -37,10 +37,10 @@ class TestTextFile(unittest.TestCase): ...@@ -37,10 +37,10 @@ class TestTextFile(unittest.TestCase):
class TestRecordIO(unittest.TestCase): class TestRecordIO(unittest.TestCase):
def test_RecordIO(self): def test_recordio(self):
path = os.path.join( path = os.path.join(
os.path.dirname(__file__), "test_recordio_creator.dat") os.path.dirname(__file__), "test_recordio_creator.dat")
reader = paddle.v2.reader.creator.RecordIO(path) reader = paddle.v2.reader.creator.recordio(path)
for idx, r in enumerate(reader()): for idx, r in enumerate(reader()):
self.assertSequenceEqual(r, str(idx)) self.assertSequenceEqual(r, str(idx))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册