diff --git a/functions.py b/functions.py index fc1b6f45ee1d304684e60f24154b6cf776ab3978..5d39d80f27d7d2bdf74ecd76be60564dade8858e 100644 --- a/functions.py +++ b/functions.py @@ -143,8 +143,10 @@ class MatMul(_Function): # TODO: Implement the derivative dx for this opetation and add the # result of the chain rule on self.dx. ####################################################################### - self.dx = grad.dot(self.y.data.transpose()) - self.dy = grad.dot(self.x.data.transpose()) + #self.dx = grad.dot(self.y.data.transpose()) + #self.dy = grad.dot(self.x.data.transpose()) + self.dx = grad * np.add(self.x.data, self.y.data.transpose()) + self.dy = np.add(self.x.data.transpose(), self.y.data) * grad ####################################################################### # --------------------------- END OF YOUR CODE ------------------------ #######################################################################