Created
August 19, 2018 12:35
-
-
Save hadifar/2ee30a3b51d56c1ce7bac8c3f534522f to your computer and use it in GitHub Desktop.
placeholder and feed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mnist = tf.keras.datasets.mnist | |
| (x_train, y_train), (x_test, y_test) = mnist.load_data() | |
| # some reshaping here... | |
| X = tf.placeholder(tf.float32, [None, 784], name="X") | |
| Y_truth = tf.placeholder(tf.float32, [None, 10], name="Y") | |
| # define model, loss, and optimizer | |
| optimizer = tf.train.GradientDescentOptimizer(0.003).minimize(cross_entropy) | |
| with tf.Session() as sess: | |
| for i in range(25000): | |
| batch_X, batch_Y = data_helper.next_batch(100) | |
| train_data = {X: batch_X, Y_truth: batch_Y} | |
| sess.run(optimizer, feed_dict=train_data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment