Skip to content

batch_sampler

allennlp.data.samplers.batch_sampler

[SOURCE]


BatchSampler

class BatchSampler(Registrable)

get_batch_indices

class BatchSampler(Registrable):
 | ...
 | def get_batch_indices(
 |     self,
 |     instances: Sequence[Instance]
 | ) -> Iterable[List[int]]

get_num_batches

class BatchSampler(Registrable):
 | ...
 | def get_num_batches(self, instances: Sequence[Instance]) -> int

get_batch_size

class BatchSampler(Registrable):
 | ...
 | def get_batch_size(self) -> Optional[int]

Not all BatchSamplers define a consistent batch_size, but those that do should override this method.