Improved backward_pass of ActivationLayer

This commit is contained in:
lluni 2023-02-04 17:45:31 +01:00
parent 3d024259ee
commit 16b6072d80
Signed by: lluni
GPG key ID: ACEEB468BC325D35

View file

@ -30,8 +30,6 @@ impl Layer for ActivationLayer {
} }
fn backward_pass(&mut self, output_error: ArrayView1<f64>, _learning_rate: f64) -> Array1<f64> { fn backward_pass(&mut self, output_error: ArrayView1<f64>, _learning_rate: f64) -> Array1<f64> {
let mut temp = (self.activation_prime)(&self.input); (self.activation_prime)(&self.input) * output_error
temp.zip_mut_with(&output_error, |x, y| *x *= y);
temp
} }
} }