# BatchSampler

Source: https://www.tensorplay.cn/docs/generated/tensorplay.utils.data.BatchSampler.html

# BatchSampler

class tensorplay.utils.data.BatchSampler(sampler: [Sampler](tensorplay.utils.data.Sampler.html#tensorplay.utils.data.Sampler)[[int](https://docs.python.org/3/library/functions.html#int)] | [Iterable](https://docs.python.org/3/library/typing.html#typing.Iterable)[[int](https://docs.python.org/3/library/functions.html#int)], batch_size: [int](https://docs.python.org/3/library/functions.html#int), drop_last: [bool](https://docs.python.org/3/library/functions.html#bool))[[source]](../_modules/tensorplay/utils/data.html#BatchSampler)

Wraps another sampler to yield a mini-batch of indices.

Parameters:

- sampler ([Sampler](tensorplay.utils.data.Sampler.html#tensorplay.utils.data.Sampler) or Iterable ) – Base sampler. Can be any iterable object

- batch_size ([int](https://docs.python.org/3/library/functions.html#int)) – Size of mini-batch.

- drop_last ([bool](https://docs.python.org/3/library/functions.html#bool)) – If True , the sampler will drop the last batch if its size would be less than batch_size
