Skip to content

Commit

Permalink
fix: np array astype (#173)
Browse files Browse the repository at this point in the history
fix: np array astype
  • Loading branch information
chaoming0625 authored Apr 20, 2022
2 parents 31a1072 + 2ae560e commit f941d6a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions brainpy/connect/custom_conn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit f941d6a

Please sign in to comment.