UnimplementedError: "Cast string to float is not supported" | Function call stack: predict_function

UnimplementedError: "Cast string to float is not supported" | Function call stack: predict_function

我正在尝试进行多变量时间序列预测,但是当我调用 model.predict(input_x, verbose=1) 时 returns

UnimplementedError:  Cast string to float is not supported
     [[node sequential_5/Cast (defined at <ipython-input-6-ebf024c56d89>:111) ]] [Op:__inference_predict_function_78009]

Function call stack:
predict_function

但是,当我打印出 input_xtype(input_x) 时,我得到

[[['Signal_1']
  ['Signal_2']
  ['Signal_3']
  ['Signal_4']
  ['Signal_5']]]
<class 'numpy.ndarray'>

根据 Tensorflow documentation,应该是可接受的输入形式:

Input samples. It could be: A Numpy array (or array-like), or a list of arrays (in case the model has multiple inputs)

输入必须是整数数组,您需要将字符串输入编码为整数