From 8c99c113020bae64e3b176168aaed7b00065d328 Mon Sep 17 00:00:00 2001 From: Maxxhim <maxc2507@gmail.com> Date: Fri, 3 Apr 2020 11:16:12 +0200 Subject: [PATCH] patch v1 Division --- functions.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/functions.py b/functions.py index f10db77..ce92027 100644 --- a/functions.py +++ b/functions.py @@ -55,7 +55,7 @@ class Sub(_Function): # Implement the forward pass and put the result in self.result. # The notbook provide you the formulas for this operation. ####################################################################### - self.result = x.data - y.data + self.result = self.x.data - self.y.data ####################################################################### # --------------------------- END OF YOUR CODE ------------------------ ####################################################################### @@ -91,8 +91,8 @@ class Mul(_Function): # Implement the derivative dx for this opetation and add the # result of the chain rule on self.dx. ####################################################################### - self.dx = self.grad * self.y.data - self.dy = self.grad * self.x.data + self.dx = grad * self.y.data + self.dy = grad * self.x.data ####################################################################### # --------------------------- END OF YOUR CODE ------------------------ ####################################################################### @@ -117,8 +117,8 @@ class Div(_Function): # TODO: Implement the derivative dx for this opetation and add the # result of the chain rule on self.dx. ####################################################################### - self.dx = self.grad * (1/self.y.data) - self.dy = self.grad * ((-1/(self.y.data)^2) * self.x.data) + self.dx = grad * (1/self.y.data) + self.dy = grad * ((-1/(self.y.data)^2) * self.x.data) ####################################################################### # --------------------------- END OF YOUR CODE ------------------------ ####################################################################### -- GitLab