且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在 lstm 中使用卷积 1D?

更新时间:2023-12-02 18:24:52

问题在于输入数据和输入形状之间.

The problem is between your input data and your input shape.

  • 你在模型中说你的输入形状是 (12,1) (= batch_shape=(None,12,1))
  • 但是您的数据 X_train_t 具有 (1,64,1) 形状.
  • You said in the model that your input shape is (12,1) (= batch_shape=(None,12,1))
  • But your data X_train_t has shape (1,64,1).

要么修复模型的输入形状,要么修复数据(如果这不是预期的形状).

Either you fix the input shape of the model, or you fix your data if this is not the expected shape.

对于可变长度/时间步长,您可以使用 input_shape=(None,1).

For variable lengths/timesteps, you can use input_shape=(None,1).

第二层不需要 input_shape.

You don't need an input_shape in the second layer.