예제 #1
0
파일: Network.cs 프로젝트: Fylipp/mlp-cs
        /// <summary>
        /// Creates a network with the given non-input layers.
        /// </summary>
        /// <param name="inputDimension">The dimension of the input</param>
        /// <param name="nonInputLayers">The non-input layers</param>
        public Network(int inputDimension, [NotNull] params Layer[] nonInputLayers)
        {
            InputDimension = inputDimension;
            NonInputLayers = nonInputLayers;

            if (InputDimension < 1)
            {
                throw new ArgumentException("Network input dimension must be at least 1");
            }

            if (NonInputLayers.Any(layer => layer == null))
            {
                throw new NullReferenceException("Layer may not be null");
            }
        }
예제 #2
0
파일: Network.cs 프로젝트: Fylipp/mlp-cs
 public double[] Calculate([NotNull] params double[] inputValues) =>
 NonInputLayers.Aggregate(inputValues, (values, layer) => layer.Calculate(values));