comparison dataset.py @ 200:ac61f1178f88

bugfix?
author Frederic Bastien <bastienf@iro.umontreal.ca>
date Thu, 15 May 2008 13:04:20 -0400
parents 1400fa04dfab
children c9c966cab763
comparison
equal deleted inserted replaced
199:1400fa04dfab 200:ac61f1178f88
1175 self.current=0 1175 self.current=0
1176 self.output_dataset=output_dataset 1176 self.output_dataset=output_dataset
1177 self.input_iterator=output_dataset.input_dataset.__iter__() 1177 self.input_iterator=output_dataset.input_dataset.__iter__()
1178 def __iter__(self): return self 1178 def __iter__(self): return self
1179 def next(self): 1179 def next(self):
1180 function_inputs = self.input_iterator.next()
1181 if self.output_dataset.minibatch_mode: 1180 if self.output_dataset.minibatch_mode:
1181 function_inputs = [[input] for input in self.input_iterator.next()]
1182 outputs = self.output_dataset.function(*function_inputs) 1182 outputs = self.output_dataset.function(*function_inputs)
1183 assert all([hasattr(output,'__iter__') for output in outputs]) 1183 assert all([hasattr(output,'__iter__') for output in outputs])
1184 function_outputs = [output[0] for output in outputs] 1184 function_outputs = [output[0] for output in outputs]
1185 else: 1185 else:
1186 function_inputs = self.input_iterator.next()
1186 function_outputs = self.output_dataset.function(*function_inputs) 1187 function_outputs = self.output_dataset.function(*function_inputs)
1187 return Example(self.output_dataset.output_names,function_outputs) 1188 return Example(self.output_dataset.output_names,function_outputs)
1188 return ApplyFunctionSingleExampleIterator(self) 1189 return ApplyFunctionSingleExampleIterator(self)
1189 1190
1190 1191