%% Apply Instance Normalization
% Create randomized input data with two spatial, one channel, and one observation dimension.

width = 12;
height = 12;
channels = 6;
numObservations = 16;
X = randn(width,height,channels,numObservations);
dlX = dlarray(X,'SSCB'); 

% Create the learnable parameters.

offset = dlarray(zeros(channels,1));
scaleFactor = dlarray(ones(channels,1));

% Calculate the instance normalization.

dlZ = instancenorm(dlX,offset,scaleFactor);

% View the size and format of the normalized data.

size(dlZ)
dims(dlZ)

% Copyright 2020 The MathWorks, Inc.