Skip to content

Instantly share code, notes, and snippets.

@hietalajulius
Created July 28, 2023 12:41
Show Gist options
  • Save hietalajulius/720cd57ece945ee0f5ea8c3bc45a6838 to your computer and use it in GitHub Desktop.
Save hietalajulius/720cd57ece945ee0f5ea8c3bc45a6838 to your computer and use it in GitHub Desktop.
/// Perform backward pass through the ReLU activation function.
fn backward(&mut self, dL_dy: &Array2<f64>) -> Array2<f64> {
// Calculate dL/dx = dL/dy * dy/dx
dL_dy * &self.dy_dx.clone().expect("Need to call forward() first.")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment