brainstate 0.0.2.post20240910__py2.py3-none-any.whl → 0.0.2.post20240913__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- brainstate/init/_regular_inits.py +7 -7
- {brainstate-0.0.2.post20240910.dist-info → brainstate-0.0.2.post20240913.dist-info}/METADATA +1 -1
- {brainstate-0.0.2.post20240910.dist-info → brainstate-0.0.2.post20240913.dist-info}/RECORD +6 -6
- {brainstate-0.0.2.post20240910.dist-info → brainstate-0.0.2.post20240913.dist-info}/LICENSE +0 -0
- {brainstate-0.0.2.post20240910.dist-info → brainstate-0.0.2.post20240913.dist-info}/WHEEL +0 -0
- {brainstate-0.0.2.post20240910.dist-info → brainstate-0.0.2.post20240913.dist-info}/top_level.txt +0 -0
@@ -16,7 +16,7 @@
|
|
16
16
|
# -*- coding: utf-8 -*-
|
17
17
|
|
18
18
|
|
19
|
-
import brainunit as
|
19
|
+
import brainunit as u
|
20
20
|
|
21
21
|
from brainstate import environ
|
22
22
|
from ._base import Initializer, to_size
|
@@ -40,7 +40,7 @@ class ZeroInit(Initializer):
|
|
40
40
|
|
41
41
|
def __call__(self, shape):
|
42
42
|
shape = to_size(shape)
|
43
|
-
return
|
43
|
+
return u.math.zeros(shape, dtype=self.dtype)
|
44
44
|
|
45
45
|
def __repr__(self):
|
46
46
|
return f"{self.__class__.__name__}(dtype={self.dtype})"
|
@@ -60,11 +60,11 @@ class Constant(Initializer):
|
|
60
60
|
def __init__(self, value=1., dtype=None):
|
61
61
|
super(Constant, self).__init__()
|
62
62
|
self.dtype = dtype or environ.dftype()
|
63
|
-
self.value =
|
63
|
+
self.value = value
|
64
64
|
|
65
65
|
def __call__(self, shape):
|
66
66
|
shape = to_size(shape)
|
67
|
-
return
|
67
|
+
return u.math.full(shape, self.value, dtype=self.dtype)
|
68
68
|
|
69
69
|
def __repr__(self):
|
70
70
|
return f'{self.__class__.__name__}(value={self.value}, dtype={self.dtype})'
|
@@ -95,15 +95,15 @@ class Identity(Initializer):
|
|
95
95
|
def __init__(self, value=1., dtype=None):
|
96
96
|
super(Identity, self).__init__()
|
97
97
|
self.dtype = dtype or environ.dftype()
|
98
|
-
self.value =
|
98
|
+
self.value = value
|
99
99
|
|
100
100
|
def __call__(self, shape):
|
101
101
|
shape = to_size(shape)
|
102
102
|
if isinstance(shape, (tuple, list)):
|
103
103
|
if len(shape) > 2:
|
104
104
|
raise ValueError(f'Only support initialize 2D weights for {self.__class__.__name__}.')
|
105
|
-
r =
|
106
|
-
r =
|
105
|
+
r = u.math.eye(shape, dtype=self.dtype)
|
106
|
+
r = u.math.fill_diagonal(r, self.value)
|
107
107
|
return r
|
108
108
|
|
109
109
|
def __repr__(self):
|
@@ -22,7 +22,7 @@ brainstate/init/__init__.py,sha256=R1dHgub47o-WJM9QkFLc7x_Q7GsyaKKDtrRHTFPpC5g,1
|
|
22
22
|
brainstate/init/_base.py,sha256=jRTmfoUsH_315vW9YMZzyIn2KDAAsv56SplBnvOyBW0,1148
|
23
23
|
brainstate/init/_generic.py,sha256=LB7IQfswOG6X-q0QX5N8T5vZmxdygetsSBQ6iXlZ0oU,7324
|
24
24
|
brainstate/init/_random_inits.py,sha256=vNUVDdUOCXTx2i3i1enzxgg1USCzugYd56r0-2lBL-0,15919
|
25
|
-
brainstate/init/_regular_inits.py,sha256=
|
25
|
+
brainstate/init/_regular_inits.py,sha256=2jdIvII_L0FzyRX_Xv81xHjreTt69rXqJ1QPVpMm_Ww,3015
|
26
26
|
brainstate/nn/__init__.py,sha256=YJHoI8cXKVRS8f2vUl3Zegp5wm0svMz3qo9JmQJiMQk,2162
|
27
27
|
brainstate/nn/_base.py,sha256=lzbZpku3Q2arH6ZaAwjs6bhbV0RcFChxo2UcpnX5t84,8481
|
28
28
|
brainstate/nn/_connections.py,sha256=GSOW2IbpJRHdPyF4nFJ2RPgO8y6SVHT1Gn-pbri9pMk,22970
|
@@ -63,8 +63,8 @@ brainstate/transform/_make_jaxpr_test.py,sha256=K3vRUBroDTCCx0lnmhgHtgrlWvWglJO2
|
|
63
63
|
brainstate/transform/_mapping.py,sha256=G9XUsD1xKLCprwwE0wv0gSXS0NYZ-ZIsv-PKKRlOoTA,3821
|
64
64
|
brainstate/transform/_progress_bar.py,sha256=VGoRZPRBmB8ELNwLc6c7S8QhUUTvn0FY46IbBm9cuYM,3502
|
65
65
|
brainstate/transform/_unvmap.py,sha256=8Se_23QrwDdcJpFcUnnMgD6EP-4XylbhP9K5TDhW358,3311
|
66
|
-
brainstate-0.0.2.
|
67
|
-
brainstate-0.0.2.
|
68
|
-
brainstate-0.0.2.
|
69
|
-
brainstate-0.0.2.
|
70
|
-
brainstate-0.0.2.
|
66
|
+
brainstate-0.0.2.post20240913.dist-info/LICENSE,sha256=VZe9u1jgUL2eCY6ZPOYgdb8KCblCHt8ECdbtJid6e1s,11550
|
67
|
+
brainstate-0.0.2.post20240913.dist-info/METADATA,sha256=DRuco413fBXd012b5O_sUgatBsggJA_i2aPdBSpn0PU,3311
|
68
|
+
brainstate-0.0.2.post20240913.dist-info/WHEEL,sha256=bb2Ot9scclHKMOLDEHY6B2sicWOgugjFKaJsT7vwMQo,110
|
69
|
+
brainstate-0.0.2.post20240913.dist-info/top_level.txt,sha256=eQbGgKn0ptx7FDWuua0V0wr4K1VHi2iOUCYo3fUQBRA,11
|
70
|
+
brainstate-0.0.2.post20240913.dist-info/RECORD,,
|
File without changes
|
File without changes
|
{brainstate-0.0.2.post20240910.dist-info → brainstate-0.0.2.post20240913.dist-info}/top_level.txt
RENAMED
File without changes
|