%% Analyze Layer Graph for Custom Training Loop
% Create a layer graph for a custom training loop. For custom training loop workflows, the layer graph must not have an output layer.

layers = [
    imageInputLayer([28 28 1],'Normalization','none','Name','input')
    convolution2dLayer(5, 20,'Name','conv1')
    batchNormalizationLayer('Name','bn1')
    reluLayer('Name','relu1')
    convolution2dLayer(3,20,'Padding',1,'Name','conv2')
    batchNormalizationLayer('Name','bn2')
    reluLayer('Name','relu2')
    convolution2dLayer(3, 20,'Padding', 1,'Name','conv3')
    batchNormalizationLayer('Name','bn3')
    reluLayer('Name','relu3')
    fullyConnectedLayer(10,'Name','fc')
    softmaxLayer('Name','softmax')];

lgraph = layerGraph(layers);

% Analyze the layer graph using the analyzeNetwork function and set the 'TargetUsage' option to 'dlnetwork'.

analyzeNetwork(lgraph,'TargetUsage','dlnetwork')

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