Skip to content

Commit f941d6a

Browse files
authored
fix: np array astype (#173)
fix: np array astype
2 parents 31a1072 + 2ae560e commit f941d6a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

brainpy/connect/custom_conn.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def __init__(self, conn_mat):
2525
self.pre_num, self.post_num = conn_mat.shape
2626
self.pre_size, self.post_size = (self.pre_num,), (self.post_num,)
2727

28-
self.conn_mat = np.asarray(conn_mat, dtype=MAT_DTYPE)
28+
self.conn_mat = np.asarray(conn_mat).astype(MAT_DTYPE)
2929

3030
def __call__(self, pre_size, post_size):
3131
assert self.pre_num == tools.size2num(pre_size)
@@ -47,8 +47,8 @@ def __init__(self, i, j):
4747
assert i.size == j.size
4848

4949
# initialize the class via "pre_ids" and "post_ids"
50-
self.pre_ids = np.asarray(i, dtype=IDX_DTYPE)
51-
self.post_ids = np.asarray(j, dtype=IDX_DTYPE)
50+
self.pre_ids = np.asarray(i).astype(IDX_DTYPE)
51+
self.post_ids = np.asarray(j).astype(IDX_DTYPE)
5252

5353
def __call__(self, pre_size, post_size):
5454
super(IJConn, self).__call__(pre_size, post_size)
@@ -80,7 +80,7 @@ def __init__(self, csr_mat):
8080
f'Please run "pip install scipy" to install scipy.')
8181

8282
assert isinstance(csr_mat, csr_matrix)
83-
csr_mat.data = np.asarray(csr_mat.data, dtype=MAT_DTYPE)
83+
csr_mat.data = np.asarray(csr_mat.data).astype(MAT_DTYPE)
8484
self.csr_mat = csr_mat
8585
self.pre_num, self.post_num = csr_mat.shape
8686

0 commit comments

Comments
 (0)