Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The code does not inhibit the learning process of the discriminator #10

Open
fabbrimatteo opened this issue Jan 25, 2017 · 3 comments
Open

Comments

@fabbrimatteo
Copy link

fabbrimatteo commented Jan 25, 2017

The line discriminator.trainable = False does not stop the discriminator from learning. Replace that types of line with a call at the following function:

def make_trainable(net, val):
     net.trainable = val
     for l in net.layers:
         l.trainable = val
@jacobgil
Copy link
Owner

Thanks for the issue.
It seems that .trainable = False freezes the entire model.
Also discussed here: keras-team/keras#4510
Can you please elaborate why do you think it should be set for each layer separately?

@li-js
Copy link

li-js commented Mar 22, 2017

After setting the flag, do we need to re-compile the model before the parameters can be frozen?
Here is a quotation from https://keras.io/getting-started/faq/

How can I "freeze" Keras layers?

Additionally, you can set the trainable property of a layer to True or False after instantiation. For this to take effect, you will need to call compile() on your model after modifying the trainable property

@fabbrimatteo
Copy link
Author

fabbrimatteo commented Mar 22, 2017

@jacobgil i am confused by the fact that if you run:

model.summary()

before and after the command .trainable=False you can see that the number of trainable parameters does not change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants