def chage_optimizer(self, new_config, change_out_unit=False):
    '\n        Recompile the model with the new loss and optimizer.\n        NOTE: network topology is not changing.\n        '
    if new_config['freeze_wt']:
        for layer in self.model.layers[:(- 4)]:
            layer.trainable = False
    input = self.model.get_layer(name='input').output
    output = self.model.get_layer(name='output').output
    if change_out_unit:
        la = self.model.layers[(- 2)].output
        output = Activation(activation=new_config['out_score'], name='output')(la)
        print(('[INFO] output scores has been changed: %s to %s' % (self.config['out_score'], new_config['out_score'])))
    self._compile_model(input=input, output=output, params=new_config)
Recompile the model with the new loss and optimizer.
NOTE: network topology is not changing.
def chage_optimizer(self, new_config, change_out_unit=False):
    '\n        Recompile the model with the new loss and optimizer.\n        NOTE: network topology is not changing.\n        '
    if new_config['freeze_wt']:
        for layer in self.model.layers[:(- 4)]:
            layer.trainable = False
    input = self.model.get_layer(name='input').output
    output = self.model.get_layer(name='output').output
    if change_out_unit:
        la = self.model.layers[(- 2)].output
        output = Activation(activation=new_config['out_score'], name='output')(la)
        print(('[INFO] output scores has been changed: %s to %s' % (self.config['out_score'], new_config['out_score'])))
    self._compile_model(input=input, output=output, params=new_config)