how to freeze and reset the weights to initial values of neural network.?
20 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have a trained RL agent and now i want to retrain only a selected few layers of same agent while keeping some of layers of actor and critic to remain freezed. how can i do it ? I am attaching a agent for reference .
So i need two things one is how to freeze a certain layers of actor and critic network while training an RL agent again.
and how can i reset the weights of a specific layer of trained RL agent`s actor and critic network.
any help would be really appreciated thanks.
0 Commenti
Risposte (1)
Emmanouil Tzorakoleftherakis
il 12 Feb 2024
You can accomplish what you asked with something along the lines of:
init_model = getModel(getCritic(agent));
new_model_layers = init_model.Layers;
new_model_layers(2).WeightLearnRateFactor = 0; %select appropriate index
new_model_layers(2).Weights = single(zeros(20,4));
new_model = dlnetwork(new_model_layers);
%reset critic
critic = getCritic(agent);
critic = setModel(critic,new_model);
agent = setCritic(agent,critic);
0 Commenti
Vedere anche
Categorie
Scopri di più su Deep Learning Toolbox in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!