Keras重复矢量维错误

时间:2019-11-01 02:01:07

标签: tensorflow keras neural-network lstm autoencoder

我是KERAS的一名新手,我决定建立自己的自动编码器网络。

我有一些尺寸为(10 006,45)的数据,我正在尝试将其适合以下模型:

    training_set = get_training_set()
    inputs = Input(shape=(training_set.shape[0], training_set.shape[1]))
    l1 = LSTM(64, activation="relu", return_sequences="True")(inputs)
    l2 = LSTM(32, activation="relu", return_sequences="True")(l1)
    l3 = LSTM(16, activation="relu", return_sequences="False")(l2)
    l4 = RepeatVector(45)(l3)
    l5 = LSTM(16, activation="relu", return_sequences="True")(l4)
    l6 = LSTM(32, activation="relu", return_sequences="True")(l5)
    l7 = LSTM(64, activation="relu", return_sequences="True")(l6)
    output = TimeDistributed(Dense(input_shape=(training_set.shape[0],training_set.shape[1])))[l7]
    return Model(output, inputs)

不幸的是,当我尝试构建此模型时。与l4一致(不在第一个LSTM中),我得到以下错误: ValueError:输入0与图层repeat_vector_1不兼容:预期ndim = 2,发现ndim = 3

你能给我任何线索吗?我以为我应该在这里(num_of_timesteps,num_of_features),但似乎是错误的,那么这里应该是什么?您对如何转换我的数据有任何建议吗?

先谢谢您

0 个答案:

没有答案