From 87d38cbc1de4056a0efb35def63fb3292f57acb1 Mon Sep 17 00:00:00 2001
From: Maxxhim <maxc2507@gmail.com>
Date: Fri, 3 Apr 2020 15:57:31 +0200
Subject: [PATCH] patch v3 matrix mult

---
 functions.py | 4 ++--
 variable.py  | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/functions.py b/functions.py
index cf808d0..fc1b6f4 100644
--- a/functions.py
+++ b/functions.py
@@ -143,8 +143,8 @@ 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 * np.add(self.x.data, self.y.data.transpose())
-        self.dy = grad * np.add(self.x.data.transpose(), self.y.data)
+        self.dx = grad.dot(self.y.data.transpose())
+        self.dy = grad.dot(self.x.data.transpose())
         #######################################################################
         # --------------------------- END OF YOUR CODE ------------------------
         #######################################################################
diff --git a/variable.py b/variable.py
index 2690125..a35ad1c 100644
--- a/variable.py
+++ b/variable.py
@@ -115,7 +115,7 @@ class Variable:
                              "\n\tShape of data: {}".format(self.shape))
         if self.grad is None:
             #######################################################################
-            # TODO: Update the current grad (self.grad), if the previous value
+            # Update the current grad (self.grad), if the previous value
             # is None. What should be the update ?
             #######################################################################
             self.grad = grad
@@ -124,7 +124,7 @@ class Variable:
             #######################################################################
         else:
             #######################################################################
-            # TODO: Update the current grad(self.grad), if the previous value
+            # Update the current grad(self.grad), if the previous value
             # is not None. What should be the update ?
             #######################################################################
             self.grad = self.grad + grad
-- 
GitLab