Keras TimeDistributed - 权重是否共享?

Mar*_*dek 5 python machine-learning neural-network deep-learning keras

来自keras docs:然后您可以使用TimeDistributedDense图层分别应用于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)
Run Code Online (Sandbox Code Playgroud)

我无法在任何地方找到它,Dense层的权重是否在时间轴上共享?

Mar*_*jko 7

是的,它们是共享的 - Dense每个都是相同的timestep.此外 - 在Keras 2.0行为TimeDistributed中,现在默认为Dense应用于输入的图层具有多于2D(包括batch_dimension).