ValueError: Tensor must be from the same graph as Tensor with Bidirectinal RNN in Tensorflow

后端 未结 3 1382
再見小時候
再見小時候 2020-12-06 09:09

I\'m doing text tagger using Bidirectional dynamic RNN in tensorflow. After maching input\'s dimension, I tried to run a Session. this is blstm setting parts:



        
相关标签:
3条回答
  • 2020-12-06 09:43

    If you are using tf 2.x with Keras - then maybe disable-ling eager execution before building the model graph could help. So to disable eager execution - adding the following line before defining the model.

    tf.compat.v1.disable_eager_execution()
    
    0 讨论(0)
  • 2020-12-06 09:49

    Or you may go to 'Kernel' and select ' Restart and clear output'. :D

    0 讨论(0)
  • 2020-12-06 09:57

    TensorFlow stores all operations on an operational graph. This graph defines what functions output to where, and it links it all together so that it can follow the steps you have set up in the graph to produce your final output. If you try to input a Tensor or operation on one graph into a Tensor or operation on another graph it will fail. Everything must be on the same execution graph.

    Try removing with tf.Graph().as_default():

    TensorFlow provides you a default graph which is referred to if you do not specify a graph. You are probably using the default graph in one spot and a different graph in your training block.

    There does not seem to be a reason you are specifying a graph as default here and most likely you are using separate graphs on accident. If you really want to specify a graph then you probably want to pass it as a variable, not set it like this.

    0 讨论(0)
提交回复
热议问题