Keras - Compile model when using theano backend (K.function) to calculate loss

258 Views Asked by At

I am building an NN in Keras and I am using Theano backend.

Code:

    cost = ((pred - target)**2).mean()
    opt = RMSprop(lr = self.lr, rho = self.rho, epsilon = self.rms_epsilon)
    #model -> keras nn
    params = self.model.trainable_weights
    updates = opt.get_updates(params, [], cost)

    self.model.compile(optimizer = opt,loss='mse')

    self._train = K.function([S, NS, A, R, T], cost, updates=updates)

If I compile this model using the above-mentioned parameters and save it, will the loaded model preserve the training configuration (loss,optim.)?

Since I use the K.function(...) method to calculate cost(loss), will this affect the model's configuration in any way?

So far I have not been able to figure out a way to check whether the resumed model's config is same as the saved one. So, is there a way to print out the network configuration to check if it has been properly restored i.e. with the exact same config and param it was saved with?

0

There are 0 best solutions below