%% Check Layer for Code Generation Compatibility
% Check code generation compatibility of the custom layer codegenPreluLayer.
% Define a custom PReLU layer with code generation support. To create this layer, save the file codegenPreluLayer.m in the current folder.
% Create an instance of the layer and check its validity using checkLayer. Specify the valid input size to be the size of a single observation of typical input to the layer. The layer expects 4-D array inputs, where the first three dimensions correspond to the height, width, and number of channels of the previous layer output, and the fourth dimension corresponds to the observations.
% Specify the typical size of the input of an observation and set the 'ObservationDimension' option to 4. To check for code generation compatibility set the 'CheckCodegenCompatibility' option to true.

layer = codegenPreluLayer(20,'prelu');
validInputSize = [24 24 20];
checkLayer(layer,validInputSize,'ObservationDimension',4,'CheckCodegenCompatibility',true)

% Here, the function does not detect any issues with the layer.
% Copyright 2020 The MathWorks, Inc.