【问题标题】:Tensorflow: adding Feedforward to LSTMTensorflow:向 LSTM 添加前馈
【发布时间】:2019-12-10 13:54:17
【问题描述】:

如何使用 Tensorflow 在标准 LSTM 网络之前添加额外的前馈层?

【问题讨论】:

    标签: tensorflow lstm feed-forward


    【解决方案1】:
    
    n_timesteps = 15
    n_dim = 5
    
    model = models.Sequential()
    model.add(layers.TimeDistributed(layers.Dense(10, activation='relu'), input_shape=(n_timesteps, n_dim)))
    model.add(layers.LSTM(25))
    model.add(layers.Dense(2, activation='softmax'))
    model.compile(loss='categorical_crossentropy', optimizer='adam')
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-07-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-14
      • 2016-11-29
      相关资源
      最近更新 更多