Effacer les filtres
Effacer les filtres

How can I check the existance of sub-variable in network layer

1 vue (au cours des 30 derniers jours)
Brian Park
Brian Park le 13 Juil 2023
Commenté : Brian Park le 13 Juil 2023
I'm trying to sort the layers which its 'WeightLearnRateFactor' is bigger than 0 for training a network with freezing.
So, I used isfield function to check if there is 'WeightLearnRateFactor' sub-variable in a layer.
existance = isfield(net.Layers(5, 1), 'WeightLearnRateFactor')
>> Result : existance -> 0
but it prints 0 for result, even though there is WeightLearnRateFactor in net.Layer(5,1)...
I tested it with 'Name' and other variables and still can't find sub-variables..
How can I sort the layers with non-zero WeightLearnRateFactor ???
net is dlnetwork type.

Réponse acceptée

Angelo Yeo
Angelo Yeo le 13 Juil 2023
The 'WeightLearnRateFactor' is a property of Convolution2DLayer not a field. You can use isprop.
net = googlenet;
lgraph = layerGraph(net);
lgraph = removeLayers(lgraph,["prob" "output"]);
dlnet = dlnetwork(lgraph);
isprop(dlnet.Layers(5,1), "WeightLearnRateFactor")
ans = logical
0
isprop(dlnet.Layers(6,1), "WeightLearnRateFactor")
ans = logical
1

Plus de réponses (0)

Catégories

En savoir plus sur Image Data Workflows dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by