In [2]:
# Solution is available in the other "solution.py" tab
import tensorflow as tf

In [3]:
softmax_data = [0.7, 0.2, 0.1]
one_hot_data = [1.0, 0.0, 0.0]

In [4]:
softmax = tf.placeholder(tf.float32)
one_hot = tf.placeholder(tf.float32)

In [5]:
# TODO: Print cross entropy from session

cross_entropy = -tf.reduce_sum(tf.multiply(one_hot,tf.log(softmax)))

with tf.Session() as sess:
    print(sess.run(cross_entropy, feed_dict={softmax: softmax_data, one_hot: one_hot_data}))


0.356675

In [ ]: