(self)
| 65 | return self |
| 66 | |
| 67 | def _next_indices(self): |
| 68 | num_items = self.dataset.shape[0] |
| 69 | if self.index >= num_items: |
| 70 | raise StopIteration |
| 71 | end_idx = self.index + self.batch_size |
| 72 | if end_idx > num_items: |
| 73 | if self.drop_last: |
| 74 | raise StopIteration |
| 75 | end_idx = num_items |
| 76 | batch = self.dataset[self.index : end_idx] |
| 77 | self.index += self.batch_size |
| 78 | |
| 79 | return batch |
| 80 | |
| 81 | def __next__(self): |
| 82 | batch = self._next_indices() |