Samplers

class pytorch_wrapper.samplers.OrderedBatchWiseRandomSampler(data_source, get_order_value_callable, batch_size, seed=1234)

Bases: sphinx.ext.autodoc.importer._MockObject

Semi-randomly samples indexes from a dataset ensuring that the corresponding examples will have similar values. Values are returned by a callable.

Parameters:
  • data_source – a data source (usually a dataset object).
  • get_order_value_callable – a callable that takes as input the example’s index and returns the ordering value.
  • batch_size – the batch size.
  • seed – the initial seed.
class pytorch_wrapper.samplers.OrderedSequentialSampler(data_source, get_order_value_callable)

Bases: sphinx.ext.autodoc.importer._MockObject

Samples elements from a dataset ordered by a value returned by a callable for each example.

Parameters:
  • data_source – a data source (usually a dataset object).
  • get_order_value_callable – a callable that takes as input the example’s index and returns the ordering value.
class pytorch_wrapper.samplers.SubsetOrderedBatchWiseRandomSampler(indexes, get_order_value_callable, batch_size, seed=1234)

Bases: sphinx.ext.autodoc.importer._MockObject

Semi-randomly samples indexes from a list ensuring that the corresponding examples will have similar values. Values are returned by a callable.

Parameters:
  • indexes – a list of indexes.
  • get_order_value_callable – a callable that takes as input the example’s index and returns the ordering value.
  • batch_size – the batch size.
  • seed – the initial seed.
class pytorch_wrapper.samplers.SubsetOrderedSequentialSampler(indexes, get_order_value_callable)

Bases: sphinx.ext.autodoc.importer._MockObject

Samples elements from a list of indexes ordered by a value returned by a callable for each example.

Parameters:
  • indexes – a list of indexes.
  • get_order_value_callable – a callable that takes as input the example’s index and returns the ordering value.
class pytorch_wrapper.samplers.SubsetSequentialSampler(indexes)

Bases: sphinx.ext.autodoc.importer._MockObject

Samples elements sequentially based on a list of indexes.

Parameters:indexes – a list of indexes.