坑 之 TypeError: List of Tensors when single Tensor expected

我再使用tf.constant的时候出现了上述错误,经查阅资料发现。
报错的原因:tf.constant传参时不可以是tensor,应该是numpy等类型的。这是一个小的问题,更正就好了

例:

a = tf.constant(1) #正确
print(a) #正常输出

b = tf.constant(a) #报错
print(b) #报错

猜你喜欢

转载自blog.csdn.net/qq_41368074/article/details/114273948