MapIterator

public class MapIterator

Inherited Constants

Public Constructors

MapIterator(DatasetIterator source, Function<List<Operand<?>>, List<Operand<?>>> mapper)

Public Methods

List<Operand<?>>
getNext()
Returns a list of Operand<?> representing the components of the next dataset element.
DatasetOptional
getNextAsOptional()
Returns a `DatasetOptional` representing the components of the next dataset element.

Inherited Methods

Public Constructors

public MapIterator (DatasetIterator source, Function<List<Operand<?>>, List<Operand<?>>> mapper)

Public Methods

public List<Operand<?>> getNext ()

Returns a list of Operand<?> representing the components of the next dataset element.

In graph mode, call this method once, and use its result as input to another computation. Then in the training loop, on successive calls to session.run(), successive dataset elements will be retrieved through these components.

In eager mode, each time this method is called, the next dataset element will be returned. (This is done automatically by iterating through `Dataset` as a Java `Iterable`).

Returns
  • A List<Operand<?>> representing dataset element components.

public DatasetOptional getNextAsOptional ()

Returns a `DatasetOptional` representing the components of the next dataset element.

In eager mode, each time this method is called, the next dataset element will be returned as a `DatasetOptional`.

Use `DatasetOptional.hasValue` to check if this optional has a value, and `DatasetOptional.getValue` to retrieve the value.

Returns
  • A `DatasetOptional` representing dataset element components.