示例#1
0
        public void GradientWrtInputCheck()
        {
            const int inputWidth  = 20;
            const int inputHeight = 20;
            const int inputDepth  = 2;

            const int batchSize = 3;

            // Create layer
            var layer = new ReluLayer();

            GradientCheckTools.GradientCheck(layer, inputWidth, inputHeight, inputDepth, batchSize, 1e-6);
        }
        public void GradientWrtInputCheck()
        {
            const int inputWidth  = 15;
            const int inputHeight = 15;
            const int inputDepth  = 2;

            const int batchSize = 3;

            var layer = new FullyConnLayer <double>(2)
            {
                BiasPref = 0.1
            };

            GradientCheckTools.GradientCheck(layer, inputWidth, inputHeight, inputDepth, batchSize);
        }
        public void GradientWrtParametersCheck()
        {
            const int inputWidth  = 2;
            const int inputHeight = 2;
            const int inputDepth  = 2;
            const int batchSize   = 3;

            // Create layer
            var layer = new FullyConnLayer <double>(2)
            {
                BiasPref = 0.1
            };

            GradientCheckTools.GradienWrtParameterstCheck(inputWidth, inputHeight, inputDepth, batchSize, layer);
        }
        public void GradientWrtInputCheck()
        {
            const int inputWidth  = 20;
            const int inputHeight = 20;
            const int inputDepth  = 2;

            const int width  = 2;
            const int height = 2;

            const int batchSize = 3;

            // Create layer
            var layer = new PoolLayer <double>(width, height)
            {
                Stride = 2
            };

            GradientCheckTools.GradientCheck(layer, inputWidth, inputHeight, inputDepth, batchSize, 1e-6);
        }
        public void GradientWrtParametersCheck()
        {
            const int inputWidth  = 10;
            const int inputHeight = 10;
            const int inputDepth  = 2;

            const int filterWidth  = 3;
            const int filterHeight = 3;
            const int filterCount  = 2;

            const int batchSize = 1;

            // Create layer
            var layer = new ConvLayer <double>(filterWidth, filterHeight, filterCount)
            {
                Stride = 2
            };                                                                                        //BiasPref = 0.1

            GradientCheckTools.GradienWrtParameterstCheck(inputWidth, inputHeight, inputDepth, batchSize, layer);
        }
        public void GradientWrtInputCheck()
        {
            const int inputWidth  = 15;
            const int inputHeight = 15;
            const int inputDepth  = 2;

            const int filterWidth  = 3;
            const int filterHeight = 3;
            const int filterCount  = 5;

            const int batchSize = 3;

            // Create layer
            var layer = new ConvLayer <double>(filterWidth, filterHeight, filterCount)
            {
                Stride = 2, BiasPref = 0.1
            };

            GradientCheckTools.GradientCheck(layer, inputWidth, inputHeight, inputDepth, batchSize);
        }