How to change read only properties of Matlab Deep learning layers? (using approximation of sigmoid for LSTM Layer)

6 次查看(过去 30 天)
I want to evaluate the accuracy if I change the activation functions of a BiLSTM-Network to different approximations.
Due this I constructed a network in Matlab.
For this, I want to change the activation functions of the BiLSTM-module of the network
For a minimal example, lets assume a network like this
numHiddenUnits = 100;
numClasses = 9;
layers = [ ...
sequenceInputLayer(inputSize)
bilstmLayer(numHiddenUnits)
fullyConnectedLayer(numClasses)
softmaxLayer
classificationLayer]
I want now to set for StateActivationFunction of the BiLSTM an approximation of the tanh function which I created by my own
if I open the struct and set another parameter it says me "its ready-only"
Has anybody an idea to avoid this?

回答(1 个)

Damien T
Damien T 2022-12-6
编辑:Damien T 2022-12-6
The LSTM layer in Matlab only supports tanh and softsign activations:
Moreover, you can only set this property when creating the layer. So you would have to create a new one, and replace the original layer with the new one in your layergraph or dlnetwork.

类别

Help CenterFile Exchange 中查找有关 Sequence and Numeric Feature Data Workflows 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by