comparison datasets/dsetiter.py @ 180:76bc047df5ee

Add dtype conversion and rescaling to the read path.
author Arnaud Bergeron <abergeron@gmail.com>
date Sat, 27 Feb 2010 16:50:16 -0500
parents defd388aba0c
children 0d0677773533
comparison
equal deleted inserted replaced
179:defd388aba0c 180:76bc047df5ee
1 import numpy, theano 1 import numpy
2 2
3 class DummyFile(object): 3 class DummyFile(object):
4 def __init__(self, size): 4 def __init__(self, size):
5 self.size = size 5 self.size = size
6 6
121 raise 121 raise
122 break 122 break
123 tmpbuf = self.curfile.read(self.bufsize - len(buf)) 123 tmpbuf = self.curfile.read(self.bufsize - len(buf))
124 buf = numpy.row_stack((buf, tmpbuf)) 124 buf = numpy.row_stack((buf, tmpbuf))
125 125
126 self.buffer = numpy.asarray(buf, dtype=theano.config.floatX) 126 self.buffer = buf
127 self.curpos = 0 127 self.curpos = 0
128 128
129 def __next__(self): 129 def __next__(self):
130 r""" 130 r"""
131 Returns the next portion of the dataset. 131 Returns the next portion of the dataset.