Skip to content

Instantly share code, notes, and snippets.

@mohanr
Created May 11, 2018 07:42
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 mohanr/94f272fa76339f08c8e3edfc21856abc to your computer and use it in GitHub Desktop.
Save mohanr/94f272fa76339f08c8e3edfc21856abc to your computer and use it in GitHub Desktop.
Softmax using TensorFlow
import tensorflow as tf
import numpy as np
v = tf.constant([1.,-2.,0.5])
tv = tf.convert_to_tensor(v,dtype=np.float32)
with tf.Session() as sess:
x = tf.nn.softmax(tv)
tf.Print(x, [x], message="Softmax")
print(sess.run(x))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment