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

Method schedule_batch

dali/python/nvidia/dali/external_source.py:241–253  ·  view source on GitHub ↗

Schedule computing new batch from source callback by the parallel pool.

(self, pool, context_i, lead, batch_size, epoch_idx)

Source from the content-addressed store, hash-verified

239 pass
240
241 def schedule_batch(self, pool, context_i, lead, batch_size, epoch_idx):
242 """Schedule computing new batch from source callback by the parallel pool."""
243 if self.batch:
244 return pool.schedule_batch(
245 context_i, _TaskArgs.make_batch(self.callback_args(None, epoch_idx, lead=lead))
246 )
247 else:
248 sample_range_start = self.current_sample + batch_size * lead
249 sample_range_end = sample_range_start + batch_size
250 iteration = self.current_iter + lead
251 sample_range = _SampleRange(sample_range_start, sample_range_end, iteration, epoch_idx)
252 work_batch = _TaskArgs.make_sample(sample_range)
253 return pool.schedule_batch(context_i, work_batch)
254
255 def schedule_and_receive(self, pipeline, pool, context_i, batch_size, epoch_idx):
256 """Obtain the computed results of calling source callback in parallel pool and feed

Callers 1

prefetchMethod · 0.95

Calls 3

callback_argsMethod · 0.95
make_batchMethod · 0.80
make_sampleMethod · 0.80

Tested by

no test coverage detected