set_default_dtype#
- class brainpy.connect.set_default_dtype(mat_dtype=None, idx_dtype=None)[source]#
Set the default dtype.
Use this method, you can set the default dtype for connetion matrix and connection index.
For examples:
>>> import numpy as np >>> import brainpy as bp >>> >>> conn = bp.conn.GridFour()(4, 4) >>> conn.require('conn_mat') Array([[False, True, False, False], [ True, False, True, False], [False, True, False, True], [False, False, True, False]], dtype=bool) >>> bp.connect.set_default_dtype(mat_dtype=np.float32) >>> conn = bp.conn.GridFour()(4, 4) >>> conn.require('conn_mat') Array([[0., 1., 0., 0.], [1., 0., 1., 0.], [0., 1., 0., 1.], [0., 0., 1., 0.]], dtype=float32)