TF 2.0 is out! Get hands-on practice at TF World, Oct 28-31. Use code TF20 for 20% off select passes. Register now

tfds.as_numpy

View source

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

tfds.as_numpy(
    dataset,
    graph=None
)

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.