How to retrain a DNN keeping the weights in the hidden layers frozen in Tensorflow 2.0
Thanks for the response. I am using Tensorflow 2.0. I know that Keras has been embedded in this new version. I was actually able to solve this problem by intuition. Turns out that each layer has an attribute where we can set trainable=False. So what I did is that I collected the layers of the original model, and then set those layers I want frozen as non-trainable, leaving the weights in the later layers for fine-tuning during the retraining step.
Hello StackOverflow community:
I trained a 4 layer DNN using Tensorflow 2.0. Using a new batch of data, I wish to retrain the model weights starting from layer 2 to the output layer, while keeping the weights from earlier layers, (i.e., those attached to the inputs and layer 1) frozen. I tried to lookup in the documentation of Tensorflow 2.0, but I can't seem to find what I am looking for. What could be the setup for the codes here? Or, if there is a documentation, could please someone link me to?
Thanks.
PS: I am new to Tensorflow. I am tempted to solve this problem from scratch. But not ensuring first whether the package actually handles the job would be unwise and inefficient.