(self, batch_size: int)
| 62 | self.progress_bar.update(self.current_offset) |
| 63 | |
| 64 | def read_batch(self, batch_size: int) -> Tuple[List, List]: |
| 65 | batch, indices = [], [] |
| 66 | while len(batch) < batch_size: |
| 67 | if self.current_offset >= self.total_samples: |
| 68 | if not self.drop_last and len(batch) > 0: |
| 69 | break |
| 70 | self.progress_bar.close() |
| 71 | raise StopIteration |
| 72 | index = self.current_offset % self.dataset_size |
| 73 | batch.append(self.dataset[index]) |
| 74 | indices.append(index) |
| 75 | self.current_offset += 1 |
| 76 | |
| 77 | self.progress_bar.update(len(batch)) |
| 78 | return batch, indices |
| 79 | |
| 80 | def select_batch(self, indices: List[int]) -> List: |
| 81 | batch = [] |
no test coverage detected