Neural network 手动更改有状态LSTM网络(Keras)的激活
如何更改Keras网络中的激活?(我正在使用LSTM) 我尝试了以下方法Neural network 手动更改有状态LSTM网络(Keras)的激活,neural-network,keras,recurrent-neural-network,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 s
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
您不能更改它们,它们是经过计算的。你到底想干什么?明白吗