Copyright 2018 The TensorFlow Datasets Authors, Licensed under the Apache License, Version 2.0


In [0]:
!pip install -q tensorflow-datasets tensorflow

In [0]:
import tensorflow as tf
import tensorflow_datasets as tfds

# Construct a tf.data.Dataset
ds = tfds.load('mnist', split='train', shuffle_files=True)

# Build your input pipeline
ds = ds.shuffle(1024).batch(32).prefetch(tf.data.experimental.AUTOTUNE)
for example in ds.take(1):
  image, label = example['image'], example['label']