提交 a243bdfb 编写于 作者: Y Your Name

rm not need

上级 e915aa9c
...@@ -16,7 +16,7 @@ Creator package contains some simple reader creator, which could be used in user ...@@ -16,7 +16,7 @@ Creator package contains some simple reader creator, which could be used in user
program. program.
""" """
__all__ = ['np_array', 'text_file', "RecordIO"] __all__ = ['np_array', 'text_file']
def np_array(x): def np_array(x):
...@@ -55,22 +55,3 @@ def text_file(path): ...@@ -55,22 +55,3 @@ def text_file(path):
f.close() f.close()
return reader return reader
def RecordIO(path):
"""
Creates a data reader that outputs record one one by one from given recordio file
:path: path of recordio file
:returns: data reader of recordio file
"""
def reader():
f = recordio.reader(path)
while True:
r = f.read()
if r is None:
break
yield r
f.close()
return reader
...@@ -13,9 +13,7 @@ ...@@ -13,9 +13,7 @@
# limitations under the License. # limitations under the License.
import os import os
import unittest import unittest
import numpy as np import numpy as np
import paddle.v2.reader.creator import paddle.v2.reader.creator
...@@ -36,14 +34,5 @@ class TestTextFile(unittest.TestCase): ...@@ -36,14 +34,5 @@ class TestTextFile(unittest.TestCase):
self.assertEqual(e, str(idx * 2) + " " + str(idx * 2 + 1)) self.assertEqual(e, str(idx * 2) + " " + str(idx * 2 + 1))
class TestRecordIO(unittest.TestCase):
def test_RecordIO(self):
path = os.path.join(
os.path.dirname(__file__), "test_recordio_creator.dat")
reader = paddle.v2.reader.creator.RecordIO(path)
for idx, r in enumerate(reader()):
self.assertSequenceEqual(r, str(idx))
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册