这个错误可能是因为x不是一个张量,而是一个列表。可以通过将x转换为张量来解决这个问题,例如:

x = tf.constant(x[0])

或者,如果x是一个多维列表,可以使用tf.convert_to_tensor()将其转换为张量:

x = tf.convert_to_tensor(x)

x = tfconstantxx是张量 报错TypeError List of Tensors when single Tensor expected如何解决

原文地址: https://www.cveoy.top/t/topic/bKXD 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录