We proceed with the recipe as follows:
- We will start by loading the necessary libraries and initializing a graph. This is also a good point at which we can bring up how to set a random seed with TensorFlow. Since we will be using a random number generator from NumPy and TensorFlow, we need to set a random seed for both. With the same random seeds set, we should be able to replicate the results. We do this with the following input:
import tensorflow as tf import numpy as np import matplotlib.pyplot as plt sess = tf.Session() tf.set_random_seed(5) np.random.seed(42)
- Now we need to declare our batch size, model variables, data, and a placeholder for feeding the data in. Our computational graph will consist of feeding in our ...