手动更改有状态LSTM网络(Keras)的激活

时间:2017-07-05 14:36:50

标签: neural-network keras recurrent-neural-network

如何更改Keras网络中的激活? (我正在使用LSTM)

我尝试了以下

 def getAllActivations(self):
    activations=[]
    for layer in self.nn.layers:
        activations.append(layer.output)
    return activations
def setAllActivations(self,activations):
    i=0
    for layer in self.nn.layers:
        layer.output=activations[i]
        i+=1

但使用第layer.output=activations[i]行会出错:

AttributeError: can't set attribute

0 个答案:

没有答案