Skip to content

Instantly share code, notes, and snippets.

@avloss
Created March 10, 2017 17:29
Show Gist options
  • Save avloss/8f53630bab358a1b21e5b43e4b450cf7 to your computer and use it in GitHub Desktop.
Save avloss/8f53630bab358a1b21e5b43e4b450cf7 to your computer and use it in GitHub Desktop.
import tensorflow as tf
x = tf.placeholder(tf.float32, shape=[None, 784])
y_ = tf.placeholder(tf.float32, shape=[None, 10])
W = tf.Variable(tf.zeros([784,10]))
b = tf.Variable(tf.zeros([10]))
y = tf.matmul(x,W) + b
cross_entropy = tf.reduce_mean(
tf.nn.softmax_cross_entropy_with_logits(labels=y_, logits=y))
train_step = tf.train.GradientDescentOptimizer(0.5).minimize(cross_entropy)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment