Guest User

Untitled

a guest
Feb 24th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. # images = (?, 28, 28, 1) # MNIST images
  2.  
  3. # logits = (?, 28, 28, 256)
  4.  
  5. import tensorflow as tf
  6.  
  7. images = tf.placeholder(tf.float32, shape=[None, 28, 28, 1])
  8. # ...network goes here ...
  9. logits = tf.placeholder(tf.float32, shape=[None, 28, 28, 256])
  10.  
  11. # Softmax Cross Entropy.
  12. loss = tf.reduce_mean(tf.nn.sparse_softmax_cross_entropy_with_logits(
  13. logits=tf.reshape(logits, (-1, 256)), # [BatchHeightWidthChannel, Distribution]
  14. labels=tf.to_int32(tf.reshape(images, shape=(-1,)) # [TruePixelValues]
  15. ))
Add Comment
Please, Sign In to add comment