/// <summary>Backpropagates the given error trough the network.</summary> /// <param name="outputErrorArray">The output error to be backpropagated.</param> /// <param name="outputErrorSkip">The index of the first entry of the output error array to be used.</param> /// <param name="learning">Whether the network is being used in a training session.</param> public void BackPropagate(float[] outputErrorArray, int outputErrorSkip, bool learning = true) { Backbone.CopyArray(outputErrorArray, outputErrorSkip, this.error2, 0, this.OutputSize); for (int i = this.Layers.Count - 1; i >= 0; i -= 1) { this.Layers.ElementAt(i).BackPropagate(this.error2, this.error1, learning); float[] aux = this.error1; this.error1 = this.error2; this.error2 = aux; } }
/// <summary>Backpropagates the given error trough the network.</summary> /// <param name="outputErrorArray">The output error to be backpropagated.</param> /// <param name="outputErrorSkip">The index of the first entry of the output error to be used.</param> /// <param name="inputErrorArray">The array to be written the input error into.</param> /// <param name="inputErrorSkip">The index of the first entry of the output error array to be used.</param> /// <param name="learning">Whether the network is being used in a training session.</param> public void BackPropagate(float[] outputErrorArray, int outputErrorSkip, float[] inputErrorArray, int inputErrorSkip, bool learning) { this.BackPropagate(outputErrorArray, outputErrorSkip, learning); Backbone.CopyArray(this.error2, 0, inputErrorArray, inputErrorSkip, this.InputSize); }