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

6 views (last 30 days)
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?

Answers (1)

Damien T
Damien T on 6 Dec 2022
Edited: Damien T on 6 Dec 2022
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.

Categories

Find more on Sequence and Numeric Feature Data Workflows 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!