From 92192bf17fe74f5c451accd5001e0269f13f06db Mon Sep 17 00:00:00 2001 From: wkcn Date: Tue, 18 Jun 2024 22:23:19 +0800 Subject: [PATCH] be compatible with the latest version of NumPy --- .gitmodules | 3 --- examples/mnist_kaggle.py | 2 +- examples/mnist_train.py | 2 +- mobula/layers/Eltwise.py | 2 +- thirdparty/numpy-groupies | 1 - 5 files changed, 3 insertions(+), 7 deletions(-) delete mode 160000 thirdparty/numpy-groupies diff --git a/.gitmodules b/.gitmodules index 35aef46..e69de29 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +0,0 @@ -[submodule "thirdparty/numpy-groupies"] - path = thirdparty/numpy-groupies - url = https://github.com/ml31415/numpy-groupies diff --git a/examples/mnist_kaggle.py b/examples/mnist_kaggle.py index 843ecef..f3260cb 100644 --- a/examples/mnist_kaggle.py +++ b/examples/mnist_kaggle.py @@ -68,7 +68,7 @@ def print_info(): n = len(data) X = data[:, 1:] -labels = data[:, 0].astype(np.int) +labels = data[:, 0].astype(np.int32) # one-hot #Y = np.eye(10)[labels.ravel()] print ("Read OK", n) diff --git a/examples/mnist_train.py b/examples/mnist_train.py index aaeb9d2..31e517c 100644 --- a/examples/mnist_train.py +++ b/examples/mnist_train.py @@ -25,7 +25,7 @@ n = len(data) X = data[:, 1:] -labels = data[:, 0].astype(np.int) +labels = data[:, 0].astype(np.int32) # one-hot #Y = np.eye(10)[labels.ravel()] print ("Read OK", n) diff --git a/mobula/layers/Eltwise.py b/mobula/layers/Eltwise.py index 00bc5d0..0ba39b8 100644 --- a/mobula/layers/Eltwise.py +++ b/mobula/layers/Eltwise.py @@ -25,7 +25,7 @@ def forward(self): elif self.op == Eltwise.PROD: for i in range(len(self.X)): x = self.X[i] - x[x == 0] = 1e-100 + x[x == 0] = 1e-10 self.Y = np.prod(self.X, 0) * np.prod(self.coeffs) else: # self.op == Eltwise.MAX diff --git a/thirdparty/numpy-groupies b/thirdparty/numpy-groupies deleted file mode 160000 index dffc66e..0000000 --- a/thirdparty/numpy-groupies +++ /dev/null @@ -1 +0,0 @@ -Subproject commit dffc66eca9421505688d903b1fe1a8746d38bd1f