Exemple #1
0
        private ConvLayer simpleRectConvLayer()
        {
            var layer = new ConvLayer(outputDepth:   2,
                                      windowHeight:  3, windowWidth:  2,
                                      strideHeight:  1, strideWidth:  2,
                                      paddingHeight: 1, paddingWidth: 0,
                                      activation:    Activation.Identity);

            layer.InputHeight = 3;
            layer.InputWidth  = 4;
            layer.InputDepth  = 2;

            layer.IsTraining = true;

            layer._Build();

            var weights = new double[]
            {
                // feature map #1
                1, 0,
                1, -1,
                0, 1,

                0, 1,
                -1, 2,
                1, -1,
                1, // bias #1

                // feature map #2
                -1, 0,
                -1, 1,
                0, -1,

                0, -1,
                1, -2,
                -1, 1,
                -1, // bias #2
            };

            Array.Copy(weights, layer.Weights, layer.Weights.Length);

            return(layer);
        }