예제 #1
0
        /// <inheritdoc />
        public void FinalizeStructure(BasicNetwork theOwner, int theLayerIndex, TempStructureCounts counts)
        {
            _owner      = theOwner;
            _layerIndex = theLayerIndex;

            var prevLayer = _layerIndex > 0 ? _owner.Layers[_layerIndex - 1] : null;
            var nextLayer = _layerIndex < _owner.Layers.Count - 1 ? _owner.Layers[_layerIndex + 1] : null;

            var tc = TotalCount;

            counts.AddNeuronCount(tc);

            if (prevLayer != null)
            {
                counts.AddWeightCount(Count * prevLayer.TotalCount);
            }

            int weightIndex, layerIndex;

            if (theLayerIndex == _owner.Layers.Count - 1)
            {
                weightIndex = 0;
                layerIndex  = 0;
            }
            else
            {
                weightIndex = nextLayer.WeightIndex
                              + TotalCount * nextLayer.Count;
                layerIndex = nextLayer.NeuronIndex + nextLayer.TotalCount;
            }

            _neuronIndex = layerIndex;
            _weightIndex = weightIndex;
        }
예제 #2
0
        /// <inheritdoc />
        public void FinalizeStructure(BasicNetwork theOwner, int theLayerIndex, TempStructureCounts counts)
        {
            _owner = theOwner;
            _layerIndex = theLayerIndex;

            var prevLayer = _layerIndex > 0 ? _owner.Layers[_layerIndex - 1] : null;
            var nextLayer = _layerIndex < _owner.Layers.Count - 1 ? _owner.Layers[_layerIndex + 1] : null;

            var tc = TotalCount;
            counts.AddNeuronCount(tc);

            if (prevLayer != null)
            {
                counts.AddWeightCount(Count*prevLayer.TotalCount);
            }

            int weightIndex, layerIndex;
            if (theLayerIndex == _owner.Layers.Count - 1)
            {
                weightIndex = 0;
                layerIndex = 0;
            }
            else
            {
                weightIndex = nextLayer.WeightIndex
                              + TotalCount*nextLayer.Count;
                layerIndex = nextLayer.NeuronIndex + nextLayer.TotalCount;
            }

            _neuronIndex = layerIndex;
            _weightIndex = weightIndex;
        }
예제 #3
0
        /// <inheritdoc />
        public void finalizeStructure(BasicNetwork theOwner, int theLayerIndex, TempStructureCounts counts)
        {
            FinalizeStructure(theOwner, theLayerIndex, counts);

            var prevLayer = LayerIndex > 0 ? Owner.Layers[LayerIndex - 1] : null;
            var nextLayer = LayerIndex < Owner.Layers.Count - 1 ? Owner.Layers[LayerIndex + 1] : null;

            if (prevLayer == null)
            {
                throw new AIFHError("Conv2DLayer must have a previous layer (cannot be used as the input layer).");
            }

            var inColumns = prevLayer.DimensionCounts[0];
            var inRows    = prevLayer.DimensionCounts[1];

            _inDepth = prevLayer.DimensionCounts[2];

            _outColumns = Math.Floor((double)(inColumns + Padding * 2 - FilterRows) / Stride + 1);
            _outRows    = Math.Floor((double)(inRows + Padding * 2 - FilterColumns) / Stride + 1);
        }
예제 #4
0
        /// <summary>
        ///     Finalize the structure of the neural network.  This must be called before any training or calculation can
        ///     be performed.  After this method is called layers can no longer be added to the neural network.
        /// </summary>
        public void FinalizeStructure()
        {
            var layerCount = _layers.Count;

            _inputCount  = _layers[0].Count;
            _outputCount = _layers[layerCount - 1].Count;

            var counts = new TempStructureCounts();

            for (var i = _layers.Count - 1; i >= 0; i--)
            {
                var layer = _layers[i];

                layer.FinalizeStructure(this, i, counts);
            }

            _weights     = new double[counts.WeightCount];
            _layerOutput = new double[counts.NeuronCount];
            _layerSums   = new double[counts.NeuronCount];

            ClearOutput();
        }
예제 #5
0
        /// <summary>
        ///     Finalize the structure of the neural network.  This must be called before any training or calculation can
        ///     be performed.  After this method is called layers can no longer be added to the neural network.
        /// </summary>
        public void FinalizeStructure()
        {
            var layerCount = _layers.Count;

            _inputCount = _layers[0].Count;
            _outputCount = _layers[layerCount - 1].Count;

            var counts = new TempStructureCounts();

            for (var i = _layers.Count - 1; i >= 0; i--)
            {
                var layer = _layers[i];

                layer.FinalizeStructure(this, i, counts);
            }

            _weights = new double[counts.WeightCount];
            _layerOutput = new double[counts.NeuronCount];
            _layerSums = new double[counts.NeuronCount];

            ClearOutput();
        }
예제 #6
0
        /// <inheritdoc />
        public void finalizeStructure(BasicNetwork theOwner, int theLayerIndex, TempStructureCounts counts)
        {
            FinalizeStructure(theOwner, theLayerIndex, counts);

            var prevLayer = LayerIndex > 0 ? Owner.Layers[LayerIndex - 1] : null;
            var nextLayer = LayerIndex < Owner.Layers.Count - 1 ? Owner.Layers[LayerIndex + 1] : null;

            if (prevLayer == null)
            {
                throw new AIFHError("Conv2DLayer must have a previous layer (cannot be used as the input layer).");
            }

            var inColumns = prevLayer.DimensionCounts[0];
            var inRows = prevLayer.DimensionCounts[1];
            _inDepth = prevLayer.DimensionCounts[2];

            _outColumns = Math.Floor((double) (inColumns + Padding*2 - FilterRows)/Stride + 1);
            _outRows = Math.Floor((double) (inRows + Padding*2 - FilterColumns)/Stride + 1);
        }
예제 #7
0
 /// <inheritdoc />
 public void FinalizeStructure(BasicNetwork theOwner, int theLayerIndex, TempStructureCounts counts)
 {
     throw new NotImplementedException();
 }
예제 #8
0
 /// <inheritdoc />
 public void FinalizeStructure(BasicNetwork theOwner, int theLayerIndex, TempStructureCounts counts)
 {
     throw new NotImplementedException();
 }