%% Specify Different Scale and Bias for Each Input Element
% Assume that the layer preceding the scalingLayer is a tanhLayer with three outputs and that you want to apply a different scaling factor and bias to each out using a scalingLayer. Since the tanhLayer outputs its channels along the third dimension, the scale and bias must be 1-by-1-by-3 arrays.

scale = reshape([2.5 0.4 10],[1 1 3]);
bias = reshape([5 0 -50],[1 1 3]);

% Create the scalingLayer object.

sLayer = scalingLayer('Scale',scale,'Bias',bias);

% Confirm that the scaling layer applies the correct scale and bias values to an array with the expected dimensions.

testData = reshape([10 10 10],[1 1 3]);
predict(sLayer,testData)

% Copyright 2019 The MathWorks, Inc.