TensorFlow as build it a nice way to store data. This is for example used to store the MNIST data in the example:
>>> mnist
<tensorflow.examples.tutorials.mnist.input_data.read_data_sets.<locals>.DataSets object at 0x10f930630>
Suppose to have a input and output numpy arrays.
>>> x = np.random.normal(0,1, (100, 10))
>>> y = np.random.randint(0, 2, 100)
How can I transform them in a tf
dataset?
I want to use functions like next_batch
a NumPy array is created by using the np. array() method. The NumPy array is converted to tensor by using tf. convert_to_tensor() method.
TensorFlow implements a subset of the NumPy API, available as tf. experimental. numpy . This allows running NumPy code, accelerated by TensorFlow, while also allowing access to all of TensorFlow's APIs.
The Dataset object is only part of the MNIST tutorial, not the main TensorFlow library.
You can see where it is defined here:
GitHub Link
The constructor accepts an images and labels argument so presumably you can pass your own values there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With