def backupNetwork(self, model, backup):
weightMatrix = []
for layer in model.layers:
weights = layer.get_weights()
weightMatrix.append(weights)
# np.save('weightMatrix.npy', weightMatrix)
# print(weightMatrix.shape)
i = 0
for layer in backup.layers:
weights = weightMatrix[i]
layer.set_weights(weights)
i += 1
# def loadWeights(self,path):
# self.model.set_weights(load_model(path).get_weights())
评论列表
文章目录