Call the source callback and feed the results to the ExternalSource nodes in `pipeline`. Used for the sequential ExternalSource variant.
(self, pipeline, batch_size, epoch_idx)
| 272 | raise |
| 273 | |
| 274 | def get_batch(self, pipeline, batch_size, epoch_idx): |
| 275 | """Call the source callback and feed the results to the ExternalSource nodes in `pipeline`. |
| 276 | Used for the sequential ExternalSource variant.""" |
| 277 | try: |
| 278 | if self.batch: |
| 279 | callback_out = self.callback(*self.callback_args(None, epoch_idx)) |
| 280 | else: |
| 281 | callback_out = [ |
| 282 | self.callback(*self.callback_args(i, epoch_idx)) for i in range(batch_size) |
| 283 | ] |
| 284 | self.current_sample += batch_size |
| 285 | self.current_iter += 1 |
| 286 | except StopIteration: |
| 287 | self.reset_indices() |
| 288 | raise |
| 289 | return _ExternalDataBatch(self, pipeline, callback_out, batch_size) |
| 290 | |
| 291 | def feed(self, pipeline, callback_out, batch_size): |
| 292 | """Feed the `callback_out` data obtained from source to the ExternalSource nodes |
no test coverage detected