public void InnerProductLayer_BackwardGradient(int output, FillerConfiguration weightsFiller, FillerConfiguration biasFiller)
        {
            bool useBias = biasFiller != null;

            var config = new InnerProductLayerConfiguration(output, useBias, weightsFiller, biasFiller);
            var layer = new InnerProductLayer(config);

            var checker = new GradientChecker(1e-4f, 1e-3f);
            checker.CheckExhaustive(layer, bottom, top);
        }
Ejemplo n.º 2
0
        public void InnerProductLayer_BackwardGradient(int output, FillerConfiguration weightsFiller, FillerConfiguration biasFiller)
        {
            bool useBias = biasFiller != null;

            var config = new InnerProductLayerConfiguration(output, useBias, weightsFiller, biasFiller);
            var layer  = new InnerProductLayer(config);

            var checker = new GradientChecker(1e-4f, 1e-3f);

            checker.CheckExhaustive(layer, bottom, top);
        }
Ejemplo n.º 3
0
        public void InnerProductLayer_Setup()
        {
            var config = new InnerProductLayerConfiguration(10);

            var layer = new InnerProductLayer(config);

            layer.Setup(bottom, top);

            Assert.Equal(2, top.Num);
            Assert.Equal(10, top.Channels);
            Assert.Equal(1, top.Height);
            Assert.Equal(1, top.Width);
        }
        public void InnerProductLayer_Forward()
        {
            var weightsFiller = new UniformFillerConfiguration(0, 1);
            var biasFiller = new UniformFillerConfiguration(1, 2);

            var config = new InnerProductLayerConfiguration(10, true, weightsFiller, biasFiller);

            var layer = new InnerProductLayer(config);
            layer.Setup(bottom, top);
            layer.Forward(bottom, top);

            using (var topCpu = top.OnCpu())
            {
                int count = top.Count;

                for (int i = 0; i < count; i++)
                    Assert.True(topCpu.DataAt(i) >= 1f);
            }
        }
Ejemplo n.º 5
0
        public void InnerProductLayer_Forward()
        {
            var weightsFiller = new UniformFillerConfiguration(0, 1);
            var biasFiller    = new UniformFillerConfiguration(1, 2);

            var config = new InnerProductLayerConfiguration(10, true, weightsFiller, biasFiller);

            var layer = new InnerProductLayer(config);

            layer.Setup(bottom, top);
            layer.Forward(bottom, top);

            using (var topCpu = top.OnCpu())
            {
                int count = top.Count;

                for (int i = 0; i < count; i++)
                {
                    Assert.True(topCpu.DataAt(i) >= 1f);
                }
            }
        }
        public void InnerProductLayer_Setup()
        {
            var config = new InnerProductLayerConfiguration(10);

            var layer = new InnerProductLayer(config);
            layer.Setup(bottom, top);

            Assert.Equal(2, top.Num);
            Assert.Equal(10, top.Channels);
            Assert.Equal(1, top.Height);
            Assert.Equal(1, top.Width);
        }