TypeError: The value of a feed cannot be a tf.Tensor object.几种情况
程序员文章站
2022-07-15 15:39:13
...
1、变量相同
for i in range(config.training_epochs):
for start, end in zip(range(0, config.train_count, config.batch_size),
range(config.batch_size, config.train_count + 1, config.batch_size)):
_,c = sess.run([optimizer,cost], feed_dict={X: X[start:end],
Y: y_[start:end]})
修改
_,c = sess.run([optimizer,cost], feed_dict={X: train_X[start:end],
Y: y_[start:end]})
print("traing iter: {},".format(i))
_,cost = sess.run([optimizer,cost], feed_dict={X: train_X[start:end],
Y: y_[start:end]})
print("traing iter: {},".format(i))
修改:
_,c = sess.run([optimizer,cost], feed_dict={X: train_X[start:end],
Y: y_[start:end]})
print("traing iter: {},".format(i))
还有一种是输入变量不对称,可以使用numpy中np.reshape()函数来修改
上一篇: hash 算法