chainer.iterators.OrderSampler

class chainer.iterators.OrderSampler[source]

Base class of all order samplers.

Every order sampler subclass has to provide a method __call__(). This method is called by an iterator before a new epoch, and it should return a new index order for the next epoch.

Methods

__call__(current_order, current_position)[source]

Sample the next order.

Parameters:
  • current_order (numpy.ndarray) – 1-D array of indices. The length should be the same as the dataset to sample data from.
  • current_position (int) – The current position of an iterator.
Returns:

1-D array of indices. This is the order in which examples are sampled from a dataset in the next epoch.

Return type:

numpy.ndarray