示例#1
0
        internal Connection(Layer preLayer, Layer postLayer, WeightsInitializeFunction initFunc)
        {
            _preLayer  = preLayer;
            _postLayer = postLayer;

            Weight = initFunc(PostLayerSize, PreLayerSize);
            _dw    = new float[PreLayerSize * PostLayerSize];
        }
示例#2
0
            public static void AddConnection(WeightsInitializeFunction initFunction = null)
            {
                if (_network._layers.Count < 2)
                {
                    throw new ApplicationException("Not enough layers.");
                }
                if (_network._layers.Count - 1 == _network._connections.Count)
                {
                    throw new ApplicationException("There are enough connections.");
                }

                var lastIndex = _network._layers.Count - 1;
                var preLayer  = _network._layers[lastIndex - 1];
                var postLayer = _network._layers[lastIndex];

                _network._connections.Add(new Connection(preLayer, postLayer, initFunction ?? He));
            }