我试图了解TimeDistributed wrapper在Keras中的作用.
我得到TimeDistributed"将一个图层应用于输入的每个时间片."
但我做了一些实验并得到了我无法理解的结果.
简而言之,与LSTM层相关,TimeDistributed和Dense层具有相同的结果.
model = Sequential()
model.add(LSTM(5, input_shape = (10, 20), return_sequences = True))
model.add(TimeDistributed(Dense(1)))
print(model.output_shape)
model = Sequential()
model.add(LSTM(5, input_shape = (10, 20), return_sequences = True))
model.add((Dense(1)))
print(model.output_shape)
Run Code Online (Sandbox Code Playgroud)
对于这两种型号,我的输出形状为(无,10,1).
任何人都可以解释RNN层之后TimeDistributed和Dense层之间的区别吗?