dynamic_decode在eager_execution下报告错误? “ ValueError:未知的TensorShapes的不等式未定义。”

时间:2019-02-01 23:43:20

标签: tensorflow eager-execution

我转化通常seq2seq代码到急于执行模式时也遇到一个奇怪的问题。

我改变什么是非常简单的那个呼叫enable_eager_execution()后,我改变下列输入

def get_inputs():
    inputs = tf.placeholder(tf.int32, [None, None], name='inputs')
    targets = tf.placeholder(tf.int32, [None, None], name='targets')
    learning_rate = tf.placeholder(tf.float32, name='learning_rate')

    target_sequence_length = tf.placeholder(tf.int32, (None,), name='target_sequence_length')
    max_target_sequence_length = tf.reduce_max(target_sequence_length, name='max_target_len')
    source_sequence_length = tf.placeholder(tf.int32, (None,), name='source_sequence_length')

    return inputs, targets, learning_rate, target_sequence_length, max_target_sequence_length, source_sequence_length

input_data, targets, lr, target_sequence_length, max_target_sequence_length, source_sequence_length = get_inputs()

直接从numpy数组分配值。

然后我打电话

training_decoder_output, _,_ = tf.contrib.seq2seq.dynamic_decode(training_decoder,impute_finished=True,maximum_iterations=max_target_sequence_length)

其中training_decoder只是采用了encoder_state和一个训练助手(在training_decoder定义步骤中没有错误报告),并且错误报告显示“ ValueError:未知TensorShapes的不等式未定义。”

有人可以帮我吗?

0 个答案:

没有答案