diff --git a/functions.py b/functions.py index f10db77e7b5016a6d34de6d8526cd9ccd11469f9..ce920278dbf84cc71221f13d4cc33e11822ee2d2 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 ------------------------ #######################################################################