%% Check Custom Layer Validity
% Check the validity of the example custom layer preluLayer.
% The custom layer preluLayer, attached to this is example as a supporting file, applies the PReLU operation to the input data. To access this layer, open this example as a live script.
% Create an instance of the layer and check that it is valid using checkLayer. Set the valid input size to the typical size of a single observation input to the layer. For a single input, the layer expects observations of size h-by-w-by-c, where h, w, and c are the height, width, and number of channels of the previous layer output, respectively.
% Specify validInputSize as the typical size of an input array.

layer = preluLayer(20);
validInputSize = [5 5 20];
checkLayer(layer,validInputSize)

% The results show the number of passed, failed, and skipped tests. If you do not specify the ObservationsDimension option, or do not have a GPU, then the function skips the corresponding tests.
%
%% Check Multiple Observations
% For multi-observation input, the layer expects an array of observations of size h-by-w-by-c-by-N, where h, w, and c are the height, width, and number of channels, respectively, and N is the number of observations.
% To check the layer validity for multiple observations, specify the typical size of an observation and set the ObservationDimension option to 4.

layer = preluLayer(20);
validInputSize = [5 5 20];
checkLayer(layer,validInputSize,ObservationDimension=4)

% In this case, the function does not detect any issues with the layer.
% Copyright 2018 The MathWorks, Inc.