diffengine.datasets.samplers
¶
Submodules¶
Package Contents¶
Classes¶
Aspect ratio batch sampler. |
- class diffengine.datasets.samplers.AspectRatioBatchSampler(sampler, batch_size, bucket_ids=None, *, drop_last=False)[source]¶
Bases:
torch.utils.data.BatchSampler
Aspect ratio batch sampler.
A sampler wrapper for grouping images with similar aspect ratio into a same batch.
Args:¶
sampler (Sampler): Base sampler. batch_size (int): Size of mini-batch. bucket_ids (str | None): The path of bucket ids. If
None
, thebucket ids will be calculated automatically. Default:
None
.- drop_last (bool): If
True
, the sampler will drop the last batch if its size would be less than
batch_size
.
- Parameters:
sampler (torch.utils.data.Sampler) –
batch_size (int) –
bucket_ids (str | None) –
drop_last (bool) –
- drop_last (bool): If