【发布时间】:2021-08-01 02:41:09
【问题描述】:
我正在尝试进行时间序列预测,训练进展顺利,但传递相同的数据集来预测函数时出现以下错误。
InvalidArgumentError:从形状为 [32,1] 的张量中指定了一个形状为 [1,1] 的列表 [[节点顺序/lstm/TensorArrayUnstack/TensorListFromTensor]] [Op:__inference_predict_function_55827] 函数调用栈: predict_function
我使用的是 Statefull Lstm,并且相同的代码和模型在 tensorflow v1.14 中运行良好,但在 tensorflow v2.4 中运行良好。
我的 X_train.shape,y_train.shape 是 ((6191, 10, 1), (6191, 1)), X_test.shape=(6191, 10, 1) 和 batch_size=1
model = Sequential()
model.add(LSTM(10,batch_input_shape=(batch_size, int(i_shape[0]), int(i_shape[1])),
activation=activation,stateful=True,
kernel_regularizer=L1L2(0.01,0.001)))
Model: "sequential_6"
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
lstm_11 (LSTM) (1, 10) 480
_________________________________________________________________
dense_4 (Dense) (1, 1) 11
=================================================================
Total params: 491
Trainable params: 491
Non-trainable params: 0
_________________________________________________________________
None
如果需要任何其他信息,请告诉我。
【问题讨论】:
标签: tensorflow time-series lstm forecasting