internal ErrorVectorStack(NeuralNetwork network, BufferAllocator allocator)
        {
            Contract.Requires(network != null);
            Contract.Requires(allocator != null);

            this.network = network;
            int maxSize = network.RecurrentOptions.MaxIterations;
            int errorVectorLength = network.OutputInterfaceLength;

            errorVectors = new IntRange[maxSize];
            for (int idx = 0; idx < maxSize; idx++)
            {
                errorVectors[idx] = allocator.Alloc(errorVectorLength);
            }
        }
        public WeightRelatedValues(BufferAllocator allocator, ConnectedLayer[] layers)
        {
            Contract.Requires(allocator != null);
            Contract.Requires(layers != null);
            Contract.Requires(layers.Length > 0);

            buffers = new IntRange[layers.Length][];
            for (int layerIndex = 0; layerIndex < layers.Length; layerIndex++)
            {
                var wib = layers[layerIndex].WeightedInputBuffers;

                buffers[layerIndex] = new IntRange[wib.Length];
                for (int buffIndex = 0; buffIndex < wib.Length; buffIndex++)
                {
                    buffers[layerIndex][buffIndex] = allocator.Alloc(wib[buffIndex].WeightBuffer.Size);
                }
            }
            this.layers = layers;
        }