Path: blob/master/site/en-snapshot/tutorials/load_data/numpy.ipynb
25118 views
Kernel: Python 3
Copyright 2019 The TensorFlow Authors.
In [ ]:
Load NumPy data
This tutorial provides an example of loading data from NumPy arrays into a tf.data.Dataset
.
This example loads the MNIST dataset from a .npz
file. However, the source of the NumPy arrays is not important.
Setup
In [ ]:
Load from .npz
file
In [ ]:
Load NumPy arrays with tf.data.Dataset
Assuming you have an array of examples and a corresponding array of labels, pass the two arrays as a tuple into tf.data.Dataset.from_tensor_slices
to create a tf.data.Dataset
.
In [ ]:
Use the datasets
Shuffle and batch the datasets
In [ ]:
Build and train a model
In [ ]:
In [ ]:
In [ ]: