%% Define Softsign Layer as Function Layer
% Create a function layer object that applies the softsign operation to the input. The softsign operation is given by the function f\left(x\right)=\frac{x}{1+\left|x\right|}.

layer = functionLayer(@(X) X./(1 + abs(X)))

% Include a softsign layer, specified as a function layer, in a layer array. Specify that the layer has description "softsign".

layers = [
    imageInputLayer([28 28 1])
    convolution2dLayer(5,20)
    functionLayer(@(X) X./(1 + abs(X)),Description="softsign")
    maxPooling2dLayer(2,Stride=2)
    fullyConnectedLayer(10)
    softmaxLayer
    classificationLayer]

%
% Copyright 2021 The MathWorks, Inc.