comparison datasets/ftfile.py @ 177:be714ac9bcbd

Use izip(), not zip() to return a lazy iterator. (datasets)
author Arnaud Bergeron <abergeron@gmail.com>
date Sat, 27 Feb 2010 14:15:11 -0500
parents 954185d6002a
children 938bd350dbf0
comparison
equal deleted inserted replaced
176:d6672a7daea5 177:be714ac9bcbd
1 from pylearn.io.filetensor import _read_header, _prod 1 from pylearn.io.filetensor import _read_header, _prod
2 import numpy 2 import numpy
3 from dataset import DataSet 3 from dataset import DataSet
4 from dsetiter import DataIterator 4 from dsetiter import DataIterator
5 from itertools import izip
5 6
6 class FTFile(object): 7 class FTFile(object):
7 def __init__(self, fname): 8 def __init__(self, fname):
8 r""" 9 r"""
9 Tests: 10 Tests:
178 self._train = FTData(train_data, train_lbl) 179 self._train = FTData(train_data, train_lbl)
179 self._valid = FTData(valid_data, valid_lbl) 180 self._valid = FTData(valid_data, valid_lbl)
180 self._test = FTData(test_data, test_lbl) 181 self._test = FTData(test_data, test_lbl)
181 182
182 def _return_it(self, batchsize, bufsize, ftdata): 183 def _return_it(self, batchsize, bufsize, ftdata):
183 return zip(DataIterator(ftdata.open_inputs(), batchsize, bufsize), 184 return izip(DataIterator(ftdata.open_inputs(), batchsize, bufsize),
184 DataIterator(ftdata.open_outputs(), batchsize, bufsize)) 185 DataIterator(ftdata.open_outputs(), batchsize, bufsize))