来自 keras docs : 然后,您可以使用 TimeDistributed
将 Dense
层独立应用于 10 个时间步长中的每一个:
# as the first layer in a model
model = Sequential()
model.add(TimeDistributed(Dense(8), input_shape=(10, 16)))
# now model.output_shape == (None, 10, 8)
# subsequent layers: no need for input_shape
model.add(TimeDistributed(Dense(32)))
# now model.output_shape == (None, 10, 32)
我在任何地方都找不到它,Dense
层的权重是否在时间轴上共享?
最佳答案
是的,它们是共享的 - 完全相同的 Dense
应用于每个 timestep
。此外 - 在 Keras 2.0
中,TimeDistributed
之类的行为现在默认用于应用到超过 2D 的输入的 Dense
层(包括 batch_dimension
).
关于python - Keras TimeDistributed - 权重共享吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43265084/