DLNETWORK STATE IS ALWAYS A 0 TABLE.

5 views (last 30 days)
Francesco Ruan
Francesco Ruan on 21 Jan 2024
Answered: Ben on 9 Apr 2024
I am implemeting neural network, but when I define my Dlnetwork the State is always a 0 table, also during the training process in fact after the training my nerual structure isn't learning anything:
Below I show only a part of my code
%GENERATOR
lgraph_G = layerGraph;
Generator = [
sequenceInputLayer(30,"Name","sequence")
fullyConnectedLayer(512,"Name","DENSE_G1")
reluLayer("Name","relu_1")
fullyConnectedLayer(512,"Name","DENSE_G2")
reluLayer("Name","relu_2")
fullyConnectedLayer(512,"Name","DENSE_G4")
reluLayer("Name","relu_3")
fullyConnectedLayer(1,"Name","DENSE_G5")
];
lgraph_G = addLayers(lgraph_G,Generator);
netG = dlnetwork(Generator);
%DISCRIMINATORE
Discriminator = layerGraph(sequenceInputLayer(2,"Name","sequence"));
combined_D = [
fullyConnectedLayer(100,"Name","fc")
leakyReluLayer(0.2)
fullyConnectedLayer(100,"Name","fc_1")
leakyReluLayer(0.2)
fullyConnectedLayer(1,"Name","fc_2")
softplusLayer("Name","softplus")
];
Discriminator = addLayers(Discriminator,combined_D);
Discriminator = connectLayers(Discriminator,'sequence','fc');
Discriminator = dlnetwork(Discriminator);
combinde_D = layerGraph(combined_D);
lgraph_D = layerGraph(Discriminator);
netD = dlnetwork(lgraph_D);

Answers (1)

Ben
Ben on 9 Apr 2024
This network does not have any layers with state parameters. The learnable parameters are in the netG.Learnables and netD.Learnables properties.
Some examples of layers with state are lstmLayer (which needs to pass its state from each sequence element to the next) or batchNormalizationLayer (which needs to pass its state from one minibatch to another).
You can define custom layers with state if you need to pass state information from the layer from one forward pass to another, see the custom layer documentation.

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!