如何更改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