From f94b6a328febf266fc2ba344dca9fdc7b5710d78 Mon Sep 17 00:00:00 2001
From: Maxxhim <maxc2507@gmail.com>
Date: Fri, 3 Apr 2020 18:20:38 +0200
Subject: [PATCH] refacto relu

---
 functions.py | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/functions.py b/functions.py
index 93e6e51..c69597f 100644
--- a/functions.py
+++ b/functions.py
@@ -382,12 +382,11 @@ class ReLu(_Function):
 
     def _backward(self, grad):
         #######################################################################
-        # TODO: Implement the derivative dx for this opetation and add the
+        # Implement the derivative dx for this opetation and add the
         # result of the chain rule on self.dx.
         #######################################################################
-        # is_sup = self.x.data > 0
-        # self.dx = grad * is_sup
-        self.dx = (self.x.data > 0) * grad
+        is_sup = self.x.data > 0
+        self.dx = grad * is_sup
         #######################################################################
         # --------------------------- END OF YOUR CODE ------------------------
         #######################################################################
-- 
GitLab