Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/309.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 输出层是一个函数,而不是一个层_Python_Tensorflow - Fatal编程技术网

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)