diff --git a/functions.py b/functions.py index 93e6e513aa19d7d5dd847cd4e5ad5eb4a0caa818..c69597fd80831aa705656a8fa871d1d418ce1a3c 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 ------------------------ #######################################################################