项目场景:
这几天使用python2.7+tensorflow1.8写目标提取及情感分析的模型。因为参考的论文模型代码是这个环境,不得已使用了tensorflow1.8, tensorflow1.8很多东西和2.0都不一样。运行过程中出现了以下错误:
问题描述:
Tensorflow报错tensorflow.python.framework.errors_impl.InvalidArgumentError exception str() failed原因
在代码中使用到了placeholder,使用placeholder建模并没有发生错误,传入的数据shape也符合placeholder中的‘壳’, 而将数据通过feed_dict传入时出现错误。
x = tf.placeholder(tf.int32, [None, FLAGS.max_len])
# char_len = tf.placeholder(tf.int32, [None, words_max_len])
words_len = tf.placeholder(tf.int32, [None,])
keep_prob1 = tf.placeholder