public static void validateOutputLayer(String layerName, Layer layer){
        IActivation activation;
        ILossFunction loss;
        long nOut;
        boolean isLossLayer = false;
        if (layer instanceof BaseOutputLayer && !(layer instanceof OCNNOutputLayer)) {
            activation = ((BaseOutputLayer) layer).getActivationFn();
            loss = ((BaseOutputLayer) layer).getLossFn();
            nOut = ((BaseOutputLayer) layer).getNOut();
        } else if (layer instanceof LossLayer) {
            activation = ((LossLayer) layer).getActivationFn();
            loss = ((LossLayer) layer).getLossFn();
            nOut = ((LossLayer) layer).getNOut();
            isLossLayer = true;
        } else if (layer instanceof RnnLossLayer) {
            activation = ((RnnLossLayer) layer).getActivationFn();
            loss = ((RnnLossLayer) layer).getLossFn();
            nOut = ((RnnLossLayer) layer).getNOut();
            isLossLayer = true;
        } else if (layer instanceof CnnLossLayer) {
            activation = ((CnnLossLayer) layer).getActivationFn();
            loss = ((CnnLossLayer) layer).getLossFn();
            nOut = ((CnnLossLayer) layer).getNOut();
            isLossLayer = true;
        } else {
            //Not an output layer
            return;
        }
        OutputLayerUtil.validateOutputLayerConfiguration(layerName, nOut, isLossLayer, activation, loss);
    }
public static void validateOutputLayer ( String layerName , Layer layer ) { IActivation activation ; ILossFunction loss ; long nOut ; boolean isLossLayer = false ; if ( layer instanceof BaseOutputLayer && ! ( layer instanceof OCNNOutputLayer ) ) { activation = ( ( BaseOutputLayer ) layer ) . getActivationFn ( ) ; loss = ( ( BaseOutputLayer ) layer ) . getLossFn ( ) ; nOut = ( ( BaseOutputLayer ) layer ) . getNOut ( ) ; } else if ( layer instanceof LossLayer ) { activation = ( ( LossLayer ) layer ) . getActivationFn ( ) ; loss = ( ( LossLayer ) layer ) . getLossFn ( ) ; nOut = ( ( LossLayer ) layer ) . getNOut ( ) ; isLossLayer = true ; } else if ( layer instanceof RnnLossLayer ) { activation = ( ( RnnLossLayer ) layer ) . getActivationFn ( ) ; loss = ( ( RnnLossLayer ) layer ) . getLossFn ( ) ; nOut = ( ( RnnLossLayer ) layer ) . getNOut ( ) ; isLossLayer = true ; } else if ( layer instanceof CnnLossLayer ) { activation = ( ( CnnLossLayer ) layer ) . getActivationFn ( ) ; loss = ( ( CnnLossLayer ) layer ) . getLossFn ( ) ; nOut = ( ( CnnLossLayer ) layer ) . getNOut ( ) ; isLossLayer = true ; } else { return ; } OutputLayerUtil . validateOutputLayerConfiguration ( layerName , nOut , isLossLayer , activation , loss ) ; }
Validate the output layer (or loss layer) configuration, to detect invalid consfiugrations. A DL4JInvalidConfigException
will be thrown for invalid configurations (like softmax + nOut=1).<br>

If the specified layer is not an output layer, this is a no-op
@param layerName Name of the layer
@param layer         Layer