public ActivationLayerBackwardCompute(ActivationLayerForwardCompute forwardCompute, ConnectedLayer connectedLayer)
            : base(forwardCompute, connectedLayer)
        {
            Contract.Requires(forwardCompute != null);
            Contract.Requires(connectedLayer != null);
            Contract.Requires((connectedLayer.StructuralElementFlags & NNStructuralElement.BackwardImplementation) != 0 &&
                (connectedLayer.StructuralElementFlags & NNStructuralElement.GradientInformation) != 0);

            Function = forwardCompute.Function;
        } 
예제 #2
0
        private LayerForwardCompute CreateLayerForwardCompute(ConnectedLayer clayer, CPUNNInitParameters initPars)
        {
            LayerForwardCompute result = null;
            if (clayer.Layer is ActivationLayer)
            {
                result = new ActivationLayerForwardCompute(clayer);
            }
            
            if (result == null) throw new InvalidOperationException("Cannot build CPU Neural Network, because '" + clayer.Layer.GetType().FullName + "' layer type is unknown.");

            result.RunParallel = initPars.RunParallel;

            return result;
        }