【问题标题】:ValueError: Input 0 of layer lstm_12 is incompatible with the layer: expected ndim=3, found ndim=4ValueError: 层 lstm_12 的输入 0 与层不兼容:预期 ndim=3,发现 ndim=4
【发布时间】:2022-01-06 21:24:51
【问题描述】:

我正在研究 seq2seq 模型,我想使用Keras Blog Bonus FAQ 中给出的嵌入层。这是我的代码,其中 num_encoder_tokens 是 67,num_decoder_tokens 是 11。

我遇到了如图所示的问题。

谁能帮我重塑嵌入层的输出形状或 LSTM 的输入形状,因为我不知道该怎么做。

【问题讨论】:

  • 回答有用吗?

标签: python tensorflow keras lstm seq2seq


【解决方案1】:

您的输入应该是:

encoder_inputs = keras.Input(shape=(None,))

decoder_inputs = keras.Input(shape=(None,))

这将允许您拥有可变的输入长度。

【讨论】:

    猜你喜欢
    • 2020-06-12
    • 2019-04-14
    • 2018-09-25
    • 2017-11-18
    • 2020-04-18
    • 2019-06-04
    • 2019-08-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多