在keras中实现Many to one以及many to many的LSTM

在keras中实现Many to one以及many to many的LSTM_第1张图片

1-One-to-one
    model.add(Dense(output_size, input_shape=input_shape))
2-One-to-many: 
    model.add(RepeatVector(number_of_times, input_shape=input_shape))
    model.add(LSTM(output_size, return_sequences=True))
3-Many-to-one:
    model = Sequential()
    model.add(LSTM(1, input_shape=(timesteps, data_dim)))
4-Many-to-many
    model = Sequential()
    model.add(LSTM(1, input_shape=(timesteps, data_dim), return_sequences=True))

参考链接:https://stackoverflow.com/questions/43034960/many-to-one-and-many-to-many-lstm-examples-in-keras

你可能感兴趣的:(tensorflow)