/// <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"); } }
public double[] Calculate([NotNull] params double[] inputValues) => NonInputLayers.Aggregate(inputValues, (values, layer) => layer.Calculate(values));