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:
fw_lstm_cell = BasicLSTMCell(LSTM_DIMS)
bw_lstm_cell = BasicLSTMCell(LSTM_DIMS)
(fw_outputs, bw_outputs), _ = bidirectional_dynamic_rnn(fw_lstm_cell,
bw_lstm_cell,
x_place,
sequence_length=SEQLEN,
dtype='float32')
and this is runing part:
with tf.Graph().as_default():
# Placehoder Settings
x_place, y_place = set_placeholder(BATCH_SIZE, EM_DIMS, MAXLEN)
# BLSTM Model Building
hlogits = tf_kcpt.build_blstm(x_place)
# Compute loss
loss = tf_kcpt.get_loss(log_likelihood)
# Training
train_op = tf_kcpt.training(loss)
# load Eval method
eval_correct = tf_kcpt.evaluation(logits, y_place)
# Session Setting & Init
init = tf.global_variables_initializer()
sess = tf.Session()
sess.run(init)
# tensor summary setting
summary = tf.summary.merge_all()
summary_writer = tf.summary.FileWriter(LOG_DIR, sess.graph)
# Save
saver = tf.train.Saver()
# Run epoch
for step in range(EPOCH):
start_time = time.time()
feed_dict = fill_feed_dict(KCPT_SET['train'], x_place, y_place)
_, loss_value = sess.run([train_op, loss], feed_dict=feed_dict)
But, it give me the error:
ValueError: Tensor("Shape:0", shape=(1,), dtype=int32) must be from the same graph as Tensor("bidirectional_rnn/fw/fw/stack_2:0", shape=(1,), dtype=int32).
Help me, please
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…