ValueError: Input 0 is incompatible with layer sequential: expected shape=(None, None, 1), found...

【python报错】 ValueError: Input 0 is incompatible with layer sequential: expected shape=(None, None, 1), found shape=[None, 1, 3]
ValueError: Input 0 is incompatible with layer sequential: expected shape=(None, None, 1), found..._第1张图片
报错代码:
look_back=3
model.add(LSTM(32,input_shape=(look_back,1),return_sequences=True))
model.fit(trainX,trainY,batch_size=32,epochs=10)#此处报错
原因:input_shape形状不一样
按如下修改即可:
look_back=3
model.add(LSTM(32,input_shape=(1,look_back),return_sequences=True))

你可能感兴趣的:(python,神经网络,python)