Hands-On Neural Network Programming with C#
上QQ阅读APP看书,第一时间看更新

Neuron connection

Every neuron must be connected to other neurons, and our neuron constructor will handle connecting all the input neurons with the synapses, as follows:

public Neuron(IEnumerable<Neuron> inputNeurons) : this()
{
Ensure.That(inputNeurons).IsNotNull();

foreach (var inputNeuron in inputNeurons)
{
var synapse = new Synapse(inputNeuron, this);
inputNeuron?.OutputSynapses?.Add(synapse);
InputSynapses?.Add(synapse);
}
}