UncertaintyNN icon indicating copy to clipboard operation
UncertaintyNN copied to clipboard

Tensor not iterable in MNIST Training.ipynb

Open ianpdavies opened this issue 6 years ago • 0 comments

I'm trying to work through the MNIST Training notebook but am having trouble getting it to run as written. I think it may be because of a new TF version, or perhaps an uncaught error? Specifically, in cell 7:

for head in heads:
    **logits, class_prob = head  # unpack**
    loss = tf.losses.softmax_cross_entropy(onehot_labels=y_data, logits=logits)
    loss_per_head.append(loss)
    train_per_head.append(optimizer.minimize(loss))
    correct_prediction = tf.equal(tf.argmax(class_prob, 1), tf.argmax(y_data, 1))
    accuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32))
    accuracy_per_head.append(accuracy)

Returns the error "Tensor objects are not iterable when eager execution is not enabled". I'm using tf version 1.10.0. Anyone have tips on how to configure this to run correctly?

ianpdavies avatar Aug 01 '19 22:08 ianpdavies