TensorFlow 2.0 Beta is available Learn more

tfds.as_numpy

Converts a tf.data.Dataset to an iterable of NumPy arrays.

tfds.as_numpy(
    dataset,
    graph=None
)

View source

as_numpy converts a possibly nested structure of tf.data.Datasets and tf.Tensors to iterables of NumPy arrays and NumPy arrays, respectively.

Args:

Returns:

A structure matching dataset where tf.data.Datasets are converted to generators of NumPy arrays and tf.Tensors are converted to NumPy arrays.