错误原因:(Keras) ValueError: Failed to convert a NumPy array to a Tensor (Unsupported object type int/float)错误是因为model.fit(X, Y, ...)调用中的X与Model(inputs=Xinput, outputs=Youtput)中Xinput数据格式未对齐。如果告警是Unsupported object type int,那么Xinput的数据格式不是int,是object或者其他类型;如果告警是Unsupported object type float,那么Xinput的数据格式不是float,是object或者其他类型。
解决方法:将Xinput中的数据类型改为对应的int,或者float。即
import numpy as np
# astype
Xinput.astype(np.str_)
Xinput.astype(np.int64)
Xinput.astype(np.float32)