1
我试图修改Keras中图层的输出。我有一个编码器,将时间序列转换为潜在空间,然后,对于每个时间序列压缩,我想在时间序列中添加一些数字。修改Keras中的图层权重
比如我有:
input_d = Input((100,))
h1_d = Reshape((100, 1))(input_d)
h2_d = LSTM(150, return_sequences=True)(h1_d)
h3_d = TimeDistributed(Dense(64, activation='linear'))(h2_d)
h4_d = LSTM(150)(h3_d)
output_d = Dense(30, activation='linear')(h4_d)
我想要做这样的事情:
new_weights = []
for i in outputs_d.weights:
new_weights.append(np.vstack(([1,2,3], i)))
但问题是,我不知道在哪个时刻,我能做到这一点,因为如果在ouput_d
之后写了一个Lambda层,我无法访问权重。