Skip to content

Instantly share code, notes, and snippets.

@mohanr mohanr/softmaxtf.py
Created May 11, 2018

Embed
What would you like to do?
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
You can’t perform that action at this time.