Tensor is not an element of this graph

前端 未结 7 1161
日久生厌
日久生厌 2020-12-02 15:49

I\'m getting this error

\'ValueError: Tensor Tensor(\"Placeholder:0\", shape=(1, 1), dtype=int32) is not an element of this graph.\'

7条回答
  •  春和景丽
    2020-12-02 16:27

    Try first:

    import tensorflow as tf
    graph = tf.get_default_graph()
    

    Then, when you need to use predict:

    with graph.as_default():
         y = model.predict(X)
    

提交回复
热议问题