【问题标题】:Dimension mismatch in keras layerskeras 层中的尺寸不匹配
【发布时间】:2018-12-03 01:25:25
【问题描述】:

我正在构建一个小型 CNN+RNN 网络,如下所示。

batch_size=2048


visible = Input(shape=(batch_size,251))

embed=Embedding(58, 50)(visible)
x1=keras.layers.Conv1D(92,50,activation='relu')(embed)
x2=keras.layers.GRU(224, return_sequences=True)(x1)

x3=keras.layers.GRU(284)(x2)

predictions=Dense(1, activation='sigmoid')(x3)

我怎样才能使不同层之间的尺寸兼容性合适。仅运行这段代码,我就会收到以下错误。

ValueError: Input 0 is incompatible with layer conv1d_4: expected ndim=3, found ndim=4

【问题讨论】:

    标签: machine-learning keras recurrent-neural-network


    【解决方案1】:

    我通过如下更改输入形状来修复它。

    visible = Input(shape=(251,))
    

    【讨论】:

      猜你喜欢
      • 2016-11-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-02-26
      • 2019-06-28
      • 1970-01-01
      • 2019-01-11
      • 1970-01-01
      相关资源
      最近更新 更多