Mercurial > ift6266
diff datasets/ftfile.py @ 178:938bd350dbf0
Make the datasets iterators return theano shared slices with the appropriate types.
author | Arnaud Bergeron <abergeron@gmail.com> |
---|---|
date | Sat, 27 Feb 2010 15:09:02 -0500 |
parents | be714ac9bcbd |
children | 76bc047df5ee |
line wrap: on
line diff
--- a/datasets/ftfile.py Sat Feb 27 14:15:11 2010 -0500 +++ b/datasets/ftfile.py Sat Feb 27 15:09:02 2010 -0500 @@ -1,8 +1,8 @@ from pylearn.io.filetensor import _read_header, _prod -import numpy +import numpy, theano from dataset import DataSet from dsetiter import DataIterator -from itertools import izip +from itertools import izip, imap class FTFile(object): def __init__(self, fname): @@ -182,4 +182,5 @@ def _return_it(self, batchsize, bufsize, ftdata): return izip(DataIterator(ftdata.open_inputs(), batchsize, bufsize), - DataIterator(ftdata.open_outputs(), batchsize, bufsize)) + imap(lambda b: theano.tensor.cast(b, 'int32'), + DataIterator(ftdata.open_outputs(), batchsize, bufsize)))