MCPcopy Create free account
hub / github.com/NVIDIA/DALI / get_batch

Method get_batch

dali/python/nvidia/dali/external_source.py:274–289  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 1

_run_input_callbacksMethod · 0.80

Calls 3

callback_argsMethod · 0.95
reset_indicesMethod · 0.95
_ExternalDataBatchClass · 0.85

Tested by

no test coverage detected