Skip to content
Snippets Groups Projects
Commit f94b6a32 authored by Maxxhim's avatar Maxxhim
Browse files

refacto relu

parent 36eb675f
No related branches found
No related tags found
No related merge requests found
...@@ -382,12 +382,11 @@ class ReLu(_Function): ...@@ -382,12 +382,11 @@ class ReLu(_Function):
def _backward(self, grad): 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. # result of the chain rule on self.dx.
####################################################################### #######################################################################
# is_sup = self.x.data > 0 is_sup = self.x.data > 0
# self.dx = grad * is_sup self.dx = grad * is_sup
self.dx = (self.x.data > 0) * grad
####################################################################### #######################################################################
# --------------------------- END OF YOUR CODE ------------------------ # --------------------------- END OF YOUR CODE ------------------------
####################################################################### #######################################################################
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment