出现这样的错误是因为tensorflow的版本问题。主要是concat这个函数的位置发生了错误,为了简便,我只取一段代码:
# Combine all the pooled features
num_filters_total = num_filters * len(filter_sizes)
#self.h_pool = tf.concat(pooled_outputs, 3)
self.h_pool = tf.concat(3,pooled_outputs)
self.h_pool_flat = tf.reshape(self.h_pool, [-1, num_filters_total])
将concat函数中参数的位置换一下位置即可。
num_filters_total = num_filters * len(filter_sizes)
#self.h_pool = tf.concat(pooled_outputs, 3)
self.h_pool = tf.concat(pooled_outputs,3)
self.h_pool_flat = tf.reshape(self.h_pool, [-1, num_filters_total])