MapIterator

public class MapIterator

Inherited Constants

org.tensorflow.framework.data.DatasetIterator

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

org.tensorflow.framework.data.DatasetIterator
static DatasetIterator
fromStructure(Ops tf, List<Class<? extends TType>> outputTypes, List<Shape> outputShapes)
Creates a new iterator from a "structure" defined by `outputShapes` and `outputTypes`.
Op
Operand<?>
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.
Ops
Iterator<List<Operand<?>>>
Op
makeInitializer(Dataset dataset)
Creates and returns a TF `Op` that can be run to initialize this iterator on a dataset.
boolean
equals(Object arg0)
final Class<?>
getClass()
int
hashCode()
final void
notify()
final void
notifyAll()
String
toString()
final void
wait(long arg0, int arg1)
final void
wait(long arg0)
final void
wait()
abstract void
forEach(Consumer<? super T> arg0)
abstract Iterator<List<Operand<?>>>
iterator()
abstract Spliterator<List<Operand<?>>>
spliterator()

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.