Example #1
0
        //Compute
        public double Compute(double[] inputs)
        {
            if (Weights.Length != inputs.Length)
            {
                throw new ArgumentException("array size mismatch", "inputs");
            }

            inputs.CopyTo(Inputs, 0);

            double output = 0;

            for (int i = 0; i < Weights.Length; i++)
            {
                output += inputs[i] * Weights[i];
            }

            Output = Activation.Function(output + Bias);

            return(Output);
        }
Example #2
0
 public override NDArray <Type> Forward(NDArray <Type> X, bool isTraining)
 {
     layerInput = new NDArray <Type>(X);
     return(activation.Function(X));
 }