(self)
| 250 | return len(self.batch_sampler) |
| 251 | |
| 252 | def _get_batch(self): |
| 253 | if self.timeout > 0: |
| 254 | try: |
| 255 | return self.data_queue.get(timeout=self.timeout) |
| 256 | except queue.Empty: |
| 257 | raise RuntimeError('DataLoader timed out after {} seconds'.format(self.timeout)) |
| 258 | else: |
| 259 | return self.data_queue.get() |
| 260 | |
| 261 | def __next__(self): |
| 262 | if self.num_workers == 0: # same-process loading |