Python 输出层是一个函数,而不是一个层
我得到这个错误,但这是为其他人工作Python 输出层是一个函数,而不是一个层,python,tensorflow,Python,Tensorflow,我得到这个错误,但这是为其他人工作 TypeError: output_layer must be a Layer, received: <class ‘function’> output_layer = lambda x: tf.contrib.layers.fully_connected(x, target_vocab_size, None, scope
TypeError: output_layer must be a Layer, received: <class ‘function’>
output_layer = lambda x: tf.contrib.layers.fully_connected(x,
target_vocab_size, None, scope=decoding_scope)
我认为这可能与这一部分有关,但我不确定它到底出了什么问题,因为如果我将类型保持为int32,则测试通过,但如果我将其更改为float32,则测试不通过
start_tokens = tf.tile(tf.constant([start_of_sequence_id], dtype=tf.int32),[batch_size])
inference_helper = tf.contrib.seq2seq.GreedyEmbeddingHelper(dec_embeddings,
start_tokens = start_tokens,
end_token=end_of_sequence_id)
请提供一个最小但完全可执行的代码块,我来看看。请提供一个最小但完全可执行的代码块,我来看看
start_tokens = tf.tile(tf.constant([start_of_sequence_id], dtype=tf.int32),[batch_size])
inference_helper = tf.contrib.seq2seq.GreedyEmbeddingHelper(dec_embeddings,
start_tokens = start_tokens,
end_token=end_of_sequence_id)