title: In tensorflow, how can I read my predictions from a generator?
body: <p>I have been adapting the most convolutional network from the following tensorflow tutorial :
  <a href="https://www.tensorflow.org/tutorials/layers" rel="nofollow noreferrer">https://www.tensorflow.org/tutorials/layers</a></p>
  
  <p>I use the same code except for the shape of the inputs. when I train and evaluate, I get good results. But I would like to see a prediction so that I can know what was misclassified. However when running </p>
  
  <pre><code>y=SN_classifier.predict(input_fn=my_data_to_predict)
  </code></pre>
  
  <p>where my_data_to_predict is a numpy array of right shape, I get the following output :</p>
  
  <pre><code>&lt;generator object Estimator.predict at 0x7fb1ecefeaf0&gt;
  </code></pre>
  
  <p>I've read on forums that I should be able to read it my doing :
      for i in y:
        print(i)</p>
  
  <p>But it raises 
      'numpy.ndarray' object is not callable</p>
  
  <p>Same happens if I try :</p>
  
  <pre><code>print('Predictions: {}'.format(list(y))
  </code></pre>
  
  <p>which I read on other forums.. </p>
  
  <p>Would you have any idea of why it doesn't output my predictions ?</p>
  
  <p>Here is the part of the code where I define the predict :</p>
  
  <pre><code>predictions = {
        # Generate predictions (for PREDICT and EVAL mode)
        "classes": tf.argmax(input=logits, axis=1),
        # Add `softmax_tensor` to the graph. It is used for PREDICT and by the
        # `logging_hook`.
        "probabilities": tf.nn.softmax(logits, name="softmax_tensor")
      }
      if mode == tf.estimator.ModeKeys.PREDICT:
          return(tf.estimator.EstimatorSpec(mode=mode, predictions=predictions))
  </code></pre>
  
  <p>And where I call it :</p>
  
  <pre><code>y=SN_classifier.predict(input_fn=my_data_to_predict)
  </code></pre>
  
  <p>Thank you very much for your help, I'll take any advice, idea :)</p>