Mercurial > pylearn
comparison dataset.py @ 251:7e6edee187e3
optimization of CachedDataSet__getitem__
author | Frederic Bastien <bastienf@iro.umontreal.ca> |
---|---|
date | Tue, 03 Jun 2008 12:25:53 -0400 |
parents | c8f19a9eb10f |
children | 856d14dc4468 |
comparison
equal
deleted
inserted
replaced
250:474be3d12c23 | 251:7e6edee187e3 |
---|---|
1159 | 1159 |
1160 def __getitem__(self,i): | 1160 def __getitem__(self,i): |
1161 if type(i)==int and len(self.cached_examples)>i: | 1161 if type(i)==int and len(self.cached_examples)>i: |
1162 return self.cached_examples[i] | 1162 return self.cached_examples[i] |
1163 else: | 1163 else: |
1164 return DataSet.__getitem__(self,i) | 1164 return self.source_dataset[i] |
1165 | 1165 |
1166 class ApplyFunctionDataSet(DataSet): | 1166 class ApplyFunctionDataSet(DataSet): |
1167 """ | 1167 """ |
1168 A L{DataSet} that contains as fields the results of applying a | 1168 A L{DataSet} that contains as fields the results of applying a |
1169 given function example-wise or minibatch-wise to all the fields of | 1169 given function example-wise or minibatch-wise to all the fields of |