chainer.iterators.DaliIterator

class chainer.iterators.DaliIterator(pipeline, repeat=True)[source]

(Experimental) Iterator for DALI pipeline.

Parameters
  • pipeline – DALI pipeline.

  • repeat (bool) – If True, it infinitely loops over the dataset. Otherwise, it stops iteration at the end of the first epoch.

Methods

__enter__()[source]

With statement context manager method

This method does nothing by default. Implementation may override it to better handle the internal resources by with statement.

__exit__(exc_type, exc_value, traceback)[source]

With statement context manager method

This method does nothing by default. Implementation may override it to better handle the internal resources by with statement.

__next__()[source]

Returns the next batch.

This is a part of the iterator protocol of Python. It may raise the StopIteration exception when it stops the iteration.

__iter__()[source]

Returns self.

finalize()[source]

Finalizes the iterator and possibly releases the resources.

This method does nothing by default. Implementation may override it to better handle the internal resources.

next()[source]

Returns the next batch.

This is a part of the iterator protocol of Python. It may raise the StopIteration exception when it stops the iteration.

reset()[source]
serialize(serializer)[source]

Serializes the internal state of the iterator.

This is a method to support the serializer protocol of Chainer.

Note

It should only serialize the internal state that changes over the iteration. It should not serialize what is set manually by users such as the batch size.

Attributes

batch_size
epoch_detail
previous_epoch_detail
repeat