aymericdamien / TensorFlow-Examples

TensorFlow Tutorial and Examples for Beginners (support TF v1 & v2)
Other
43.37k stars 14.95k forks source link

Error -> TensorFlow-Examples/notebooks/2_BasicModels/random_forest.ipynb #221

Open Scoodood opened 6 years ago

Scoodood commented 6 years ago

This line is problematic on my machine OSX 10.12.6 Python 3.6.3, Anaconda 5.0.1 (64-bit)

infer_op, _, _ = forest_graph.inference_graph(X)

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-4-59429b7389b6> in <module>()
      7 
      8 # Measure the accuracy
----> 9 infer_op, _, _ = forest_graph.inference_graph(X)
     10 correct_prediction = tf.equal(tf.argmax(infer_op, 1), tf.cast(Y, tf.int64))
     11 accuracy_op = tf.reduce_mean(tf.cast(correct_prediction, tf.float32))

~/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py in __iter__(self)
    514       TypeError: when invoked.
    515     """
--> 516     raise TypeError("'Tensor' object is not iterable.")
    517 
    518   def __bool__(self):

TypeError: 'Tensor' object is not iterable.
mengxj08 commented 6 years ago

You need the latest version of TensorFlow to run this example (v1.4)