From 5f3106b164fca2f1d4c6637e07363605587b2da7 Mon Sep 17 00:00:00 2001 From: Brandon Zhang Date: Wed, 20 Apr 2022 17:00:49 +0800 Subject: [PATCH 1/2] fix: np array astype --- brainpy/connect/custom_conn.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/brainpy/connect/custom_conn.py b/brainpy/connect/custom_conn.py index 9afdf6230..a99ab3b23 100644 --- a/brainpy/connect/custom_conn.py +++ b/brainpy/connect/custom_conn.py @@ -25,7 +25,7 @@ def __init__(self, conn_mat): self.pre_num, self.post_num = conn_mat.shape self.pre_size, self.post_size = (self.pre_num,), (self.post_num,) - self.conn_mat = np.asarray(conn_mat, dtype=MAT_DTYPE) + self.conn_mat = np.asarray(conn_mat).astype(MAT_DTYPE) def __call__(self, pre_size, post_size): assert self.pre_num == tools.size2num(pre_size) From 2ae560e391045efb32d877d6f49a8c699e967def Mon Sep 17 00:00:00 2001 From: Brandon Zhang Date: Wed, 20 Apr 2022 17:15:14 +0800 Subject: [PATCH 2/2] fix: np.asarray.astype --- brainpy/connect/custom_conn.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/brainpy/connect/custom_conn.py b/brainpy/connect/custom_conn.py index a99ab3b23..879cf60ea 100644 --- a/brainpy/connect/custom_conn.py +++ b/brainpy/connect/custom_conn.py @@ -47,8 +47,8 @@ def __init__(self, i, j): assert i.size == j.size # initialize the class via "pre_ids" and "post_ids" - self.pre_ids = np.asarray(i, dtype=IDX_DTYPE) - self.post_ids = np.asarray(j, dtype=IDX_DTYPE) + self.pre_ids = np.asarray(i).astype(IDX_DTYPE) + self.post_ids = np.asarray(j).astype(IDX_DTYPE) def __call__(self, pre_size, post_size): super(IJConn, self).__call__(pre_size, post_size) @@ -80,7 +80,7 @@ def __init__(self, csr_mat): f'Please run "pip install scipy" to install scipy.') assert isinstance(csr_mat, csr_matrix) - csr_mat.data = np.asarray(csr_mat.data, dtype=MAT_DTYPE) + csr_mat.data = np.asarray(csr_mat.data).astype(MAT_DTYPE) self.csr_mat = csr_mat self.pre_num, self.post_num = csr_mat.shape