我想运行一个不同的tensorflow seq2seq模型进行训练和测试。
我尝试如下使用variable_scope:
with tf.variable_scope("train_test", reuse=True):
single_cell = tf.nn.rnn_cell.LSTMCell(memory_dim)
if num_layers > 1:
cell = tf.nn.rnn_cell.MultiRNNCell(
[single_cell] * num_layers)
else:
cell = single_cell
# Sequence to sequence model
with tf.variable_scope("train_test"):
dec_outputs, dec_memory = tf.contrib.legacy_seq2seq.embedding_attention_seq2seq(
enc_inp, dec_inp, cell, len(en_chars),
len(hi_chars), embedding_dim)
with tf.variable_scope("train_test",reuse=True):
dec_outputs1, dec_memory1 = tf.contrib.legacy_seq2seq.embedding_attention_seq2seq(
enc_inp, dec_inp, cell, len(en_chars),
len(hi_chars), embedding_dim, feed_previous=True)
但这会导致单元格出现以下错误:
NotImplementedError: __deepcopy__() is only available when eager execution is enabled.
我缺少基本的东西吗?
关于如何在不急于执行的情况下进行构想?
任何帮助表示赞赏。