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

Method ShouldPadBatch

dali/operators/reader/loader/loader.h:207–217  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

205 }
206
207 bool ShouldPadBatch(bool is_new_batch) {
208 // If the reader has depleted samples from the given shard, but shards are not equal
209 // and we need to pad samples inside batch (even create a whole new dummy batch) using padding
210 // just to return in each shard the same number of samples and batches within the epoch.
211 // It happened only when pad_last_batch_ is set
212 // First part of this condition makes sure that the same number of batches is returned in each
213 // shard. Second makes sure that padding is done up to the full batch. For the first sample in
214 // the batch is_new_batch is set so it means that padding may be no longer needed
215 return (returned_sample_counter_ < num_samples(num_shards_, Size()) || !is_new_batch) &&
216 pad_last_batch_;
217 }
218
219 // Get a random read sample
220 LoadTargetSharedPtr ReadOne(bool is_new_batch, bool is_end_of_batch) {

Callers

nothing calls this directly

Calls 2

SizeFunction · 0.85
num_samplesFunction · 0.70

Tested by

no test coverage detected