Programmatically determine which Deep Learning layer properties contain learnables
Show older comments
In the Deep Learning Toolbox, there are a variety of layer object types. The display methods of these objects indicate which object properties contain learnable parameter data. For example, for LSTMLayer objects, the learnable parameters are stored in the properties "InputWeights", "RecurrentWeights", and "Bias" as shown below. My question is, is there a way, given a layer object, to programmatically determine the subset of its properties that are learnable?
layer = lstmLayer(100,'Name','lstm1')
Accepted Answer
More Answers (1)
Let's define the a network
layers = [sequenceInputLayer(32, 'Name', 'input')
lstmLayer(128, 'OutputMode', 'sequence', 'Name', 'lstm')]
since each layer is a nnet.cnn.layer type object, one can determine
you can determine the object type using class() command.
For example,
layerType = class(layers(2))
And then you can search for a match in that class for the type you are looking for
For example
contains(class(layers(2)),'lstm','IgnoreCase',true)
you can check for specific parameters like RecurrentWeights once you identify its an LSTM, or a GRU layer..
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!