Skip to content

Instantly share code, notes, and snippets.

@JoshVarty
Created February 17, 2018 18:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JoshVarty/86accd010b2c1fb504b22b4acd54c1b2 to your computer and use it in GitHub Desktop.
Save JoshVarty/86accd010b2c1fb504b22b4acd54c1b2 to your computer and use it in GitHub Desktop.
#We flatten the last layer (pool2) and multiply it by a set of weights to produce 10 logits
shape = pool2.shape.as_list()
fc = shape[1] * shape[2] * shape[3] #7x7x256 = 6,272
reshape = tf.reshape(pool2, [-1, fc])
fc_weights = tf.Variable(tf.random_normal([fc, 10])) #6,272x10
fc_bias = tf.Variable(tf.zeros([10])) #10
#Logits are ten numbers
logits = tf.matmul(reshape, fc_weights) + fc_bias #10
#Predictions are ten numbers that are scaled to add to 1.00
predictions = tf.nn.softmax(logits) #10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment