brainstate 0.1.2__py2.py3-none-any.whl → 0.1.4__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.
Files changed (66) hide show
  1. brainstate/__init__.py +1 -1
  2. brainstate/_compatible_import.py +0 -15
  3. brainstate/compile/_jit.py +14 -5
  4. brainstate/compile/_make_jaxpr.py +78 -22
  5. brainstate/compile/_make_jaxpr_test.py +13 -2
  6. brainstate/graph/_graph_node.py +1 -1
  7. brainstate/graph/_graph_operation.py +4 -4
  8. brainstate/mixin.py +30 -14
  9. brainstate/nn/__init__.py +84 -17
  10. brainstate/nn/{_interaction/_conv.py → _conv.py} +1 -1
  11. brainstate/nn/{_dynamics/_state_delay.py → _delay.py} +19 -3
  12. brainstate/nn/{_elementwise/_dropout.py → _dropout.py} +6 -5
  13. brainstate/nn/{_dynamics/_dynamics_base.py → _dynamics.py} +137 -21
  14. brainstate/nn/{_elementwise/_elementwise.py → _elementwise.py} +1 -1
  15. brainstate/nn/{_interaction/_embedding.py → _embedding.py} +1 -1
  16. brainstate/nn/{_event/_fixedprob_mv.py → _fixedprob.py} +96 -25
  17. brainstate/nn/{_dyn_impl/_inputs.py → _inputs.py} +4 -5
  18. brainstate/nn/{_interaction/_linear.py → _linear.py} +2 -5
  19. brainstate/nn/{_event/_linear_mv.py → _linear_mv.py} +2 -2
  20. brainstate/nn/{_event/__init__.py → _ltp.py} +7 -5
  21. brainstate/nn/_module.py +5 -5
  22. brainstate/nn/{_dyn_impl/_dynamics_neuron.py → _neuron.py} +2 -2
  23. brainstate/nn/{_interaction/_normalizations.py → _normalizations.py} +1 -1
  24. brainstate/nn/{_interaction/_poolings.py → _poolings.py} +1 -1
  25. brainstate/nn/{_interaction/_poolings_test.py → _poolings_test.py} +1 -1
  26. brainstate/nn/_projection.py +486 -0
  27. brainstate/nn/{_dyn_impl/_rate_rnns.py → _rate_rnns.py} +2 -2
  28. brainstate/nn/{_dyn_impl/_readout.py → _readout.py} +3 -3
  29. brainstate/nn/_stp.py +236 -0
  30. brainstate/nn/{_dyn_impl/_dynamics_synapse.py → _synapse.py} +19 -212
  31. brainstate/nn/_synaptic_projection.py +423 -0
  32. brainstate/nn/{_dynamics/_synouts.py → _synouts.py} +4 -1
  33. brainstate/surrogate.py +1 -1
  34. brainstate/typing.py +1 -1
  35. brainstate/util/__init__.py +14 -14
  36. brainstate/util/{_pretty_pytree.py → pretty_pytree.py} +2 -2
  37. {brainstate-0.1.2.dist-info → brainstate-0.1.4.dist-info}/METADATA +1 -1
  38. {brainstate-0.1.2.dist-info → brainstate-0.1.4.dist-info}/RECORD +61 -63
  39. brainstate/nn/_dyn_impl/__init__.py +0 -42
  40. brainstate/nn/_dynamics/__init__.py +0 -37
  41. brainstate/nn/_dynamics/_projection_base.py +0 -362
  42. brainstate/nn/_elementwise/__init__.py +0 -22
  43. brainstate/nn/_interaction/__init__.py +0 -41
  44. /brainstate/nn/{_interaction/_conv_test.py → _conv_test.py} +0 -0
  45. /brainstate/nn/{_elementwise/_dropout_test.py → _dropout_test.py} +0 -0
  46. /brainstate/nn/{_dynamics/_dynamics_base_test.py → _dynamics_test.py} +0 -0
  47. /brainstate/nn/{_elementwise/_elementwise_test.py → _elementwise_test.py} +0 -0
  48. /brainstate/nn/{_event/_fixedprob_mv_test.py → _fixedprob_test.py} +0 -0
  49. /brainstate/nn/{_event/_linear_mv_test.py → _linear_mv_test.py} +0 -0
  50. /brainstate/nn/{_interaction/_linear_test.py → _linear_test.py} +0 -0
  51. /brainstate/nn/{_dyn_impl/_dynamics_neuron_test.py → _neuron_test.py} +0 -0
  52. /brainstate/nn/{_interaction/_normalizations_test.py → _normalizations_test.py} +0 -0
  53. /brainstate/nn/{_dyn_impl/_rate_rnns_test.py → _rate_rnns_test.py} +0 -0
  54. /brainstate/nn/{_dyn_impl/_readout_test.py → _readout_test.py} +0 -0
  55. /brainstate/nn/{_dyn_impl/_dynamics_synapse_test.py → _synapse_test.py} +0 -0
  56. /brainstate/nn/{_dynamics/_synouts_test.py → _synouts_test.py} +0 -0
  57. /brainstate/util/{_caller.py → caller.py} +0 -0
  58. /brainstate/util/{_error.py → error.py} +0 -0
  59. /brainstate/util/{_others.py → others.py} +0 -0
  60. /brainstate/util/{_pretty_repr.py → pretty_repr.py} +0 -0
  61. /brainstate/util/{_pretty_table.py → pretty_table.py} +0 -0
  62. /brainstate/util/{_scaling.py → scaling.py} +0 -0
  63. /brainstate/util/{_struct.py → struct.py} +0 -0
  64. {brainstate-0.1.2.dist-info → brainstate-0.1.4.dist-info}/LICENSE +0 -0
  65. {brainstate-0.1.2.dist-info → brainstate-0.1.4.dist-info}/WHEEL +0 -0
  66. {brainstate-0.1.2.dist-info → brainstate-0.1.4.dist-info}/top_level.txt +0 -0
@@ -1,15 +1,15 @@
1
- brainstate/__init__.py,sha256=50znZ0wsJBdgX9Wvlv4xvsuNGp4XdgR60LTFrplmBz0,1496
2
- brainstate/_compatible_import.py,sha256=96CR40jbcrvaBXO0Hrlm7Cpde-4nRj-6z-P753bitFc,5001
1
+ brainstate/__init__.py,sha256=A_OD4cJiVu3xpthNGJh6fhRjCKsI7_Mxsow3Al4m2-w,1496
2
+ brainstate/_compatible_import.py,sha256=LUSZlA0APWozxM8Kf9pZrM2YbwY7X3jzVVHZInaBL7Y,4630
3
3
  brainstate/_state.py,sha256=o5Kk4bGwVz6Dfj9dlmZqdh6zUXcz6Tvc6WOjH9ajlIU,60716
4
4
  brainstate/_state_test.py,sha256=b6uvZdVRyC4n6-fYzmHNry1b-gJ6zE_kRSxGinqiHaw,1638
5
5
  brainstate/_utils.py,sha256=j-b239RHfC5BnvhGbSExQpdY21LrMEyWMSHBdNGThOI,1657
6
6
  brainstate/environ.py,sha256=VgtG0S_aR1g_1gplRWg_v2ZrcS-F6LZk35BPCBgsIIA,17660
7
7
  brainstate/environ_test.py,sha256=QD6sPCKNtqemVCGwkdImjMazatrvvLr6YeAVcfUnVVY,2045
8
- brainstate/mixin.py,sha256=1PPifp91eKEeMJO8cLjZPmXehPBE5tIoRhMVpvysquo,11272
8
+ brainstate/mixin.py,sha256=LOS8WPfB6OBevdZ9wh_U6qzuw4mrCNAMcJy0yIitIBg,11522
9
9
  brainstate/mixin_test.py,sha256=Oq_0fwC9vpXDN4t4dTBhWzLdFDNlcYsrcip14F1yECI,3079
10
- brainstate/surrogate.py,sha256=Iu1-WWJKH5CIjXIHKwEF8ufxVYpFZCltU_6dEH9DYqk,53470
10
+ brainstate/surrogate.py,sha256=yPc-uhJl1r14leoKAAgTWlqBZoeH-uYUAeizuQLkJec,53455
11
11
  brainstate/transform.py,sha256=OvshYpPnp3YXPG6riy15Ve7jcX8t0aaATl1xZnsFeic,858
12
- brainstate/typing.py,sha256=XEOzcvMos8jcVeOf2rZb20M4A89xUEUpEIHu9qit2L8,10485
12
+ brainstate/typing.py,sha256=cIlcgaWbvsFyEb5GgwZD7NHJh9qAp8l-N-rYN5W9FsU,10519
13
13
  brainstate/augment/__init__.py,sha256=Q9-JIwQ1FNn8VLS1MA9MrSylbvUjWSw98whrI3NIuKo,1229
14
14
  brainstate/augment/_autograd.py,sha256=zMMLZOidQq2p96wzEOgR-MynV2JH1l1AnoJ28eVwD-s,30100
15
15
  brainstate/augment/_autograd_test.py,sha256=UhNd41luca_Kj9a8byL3Dq64Ta55WU-je-LCiK_z0Vc,45060
@@ -25,14 +25,14 @@ brainstate/compile/_conditions.py,sha256=fFSJWRFZxriAZFASj2lvlXpxbH323XcfsoB9ni2
25
25
  brainstate/compile/_conditions_test.py,sha256=bh8_D49Fl-s_xFYkO4joZJPgFGhw_vd6Wo8QB1HDKwE,8640
26
26
  brainstate/compile/_error_if.py,sha256=l8flahWEui9-9IavtZQjyutIeR8DU0jieahRvAXUxuw,2651
27
27
  brainstate/compile/_error_if_test.py,sha256=PjTIQOflegqnqJb9kO5YqwjW1OfrBmAtWlY_xn8rtDY,1897
28
- brainstate/compile/_jit.py,sha256=TN6Fk7qTHpZ2rzfBf4uyL9oFoU_IEpaDQhn1R_d_bd4,13858
28
+ brainstate/compile/_jit.py,sha256=rpM0P2t7pKyE2ak-J-TIHL4LH9uu-IsuXnklWoE1NBA,14496
29
29
  brainstate/compile/_jit_test.py,sha256=zD7kck9SQJGmUDolh9P4luKwQ21fBGje1Z4STTEXIuA,4135
30
30
  brainstate/compile/_loop_collect_return.py,sha256=qOYGoD2TMZd2Px6y241GWNwSjOLyaKlvzOwJWIPAbxg,23341
31
31
  brainstate/compile/_loop_collect_return_test.py,sha256=pEJdcOthEM17q5kXYhgR6JfzzqibijD_O1VPXVe_Ml4,1808
32
32
  brainstate/compile/_loop_no_collection.py,sha256=tPkSxee41VexWEALpN1uuT78BDrX3uT1FHv8WZtov4c,7549
33
33
  brainstate/compile/_loop_no_collection_test.py,sha256=ivavF59xep_g9bV1SSdXd5E1f6nhc7EUBfcbgHpxbfg,1419
34
- brainstate/compile/_make_jaxpr.py,sha256=nW5VV9fcqD6bo0GBWxGT2005ANox1ym7ChhGV_q5Aig,33463
35
- brainstate/compile/_make_jaxpr_test.py,sha256=wvZHl7ecQrmD6C_Nxy8z64l6r3Tj1kQEM54UNIU1Er4,4416
34
+ brainstate/compile/_make_jaxpr.py,sha256=fhaazC2Lj8-Gk3VpWLSytzVbP9dLkuTAn_1Y0SBtC9s,35864
35
+ brainstate/compile/_make_jaxpr_test.py,sha256=xPusEJikMQRfoOmUFrugGcE5UpRm0giHoL_NPomN5rI,4791
36
36
  brainstate/compile/_progress_bar.py,sha256=iTp-CkcK5aMbiA0ZdlSfEXXrc4_anifYhyDzl19dksI,7488
37
37
  brainstate/compile/_unvmap.py,sha256=9S42MeTmFJa8nfBI_AjEfrAdUsDmM3KFat59O8zXIEw,4120
38
38
  brainstate/compile/_util.py,sha256=QD7lvS4Zb3P2HPNIm6mG8Rl_Lk2tQj0znOCPcH95XnI,6275
@@ -43,9 +43,9 @@ brainstate/functional/_normalization.py,sha256=_F5u9iJm8KJfxlnmV_LwJXtrAZOJj357a
43
43
  brainstate/functional/_others.py,sha256=iAqvLCmXQz6C80EjE0-5bwXCBKHoKqsggneiOAXNmQo,1699
44
44
  brainstate/functional/_spikes.py,sha256=YJ4pa5LlywximSE6ZAAs9g2k-8cO95mwxdD29HhT-oM,7051
45
45
  brainstate/graph/__init__.py,sha256=noo4TjBg6iEhjjwk0sAGUhR7Ge-z8Vnc2rLYUvnqttw,1295
46
- brainstate/graph/_graph_node.py,sha256=zxtfzv6RXs9ylTerW5scUZ4mHic66df5WTHCrUzHLDA,6836
46
+ brainstate/graph/_graph_node.py,sha256=kl0CDKIcbXd9YzrZIKDhDeT8bboaoR5_OPwtL90eUEo,6835
47
47
  brainstate/graph/_graph_node_test.py,sha256=g6nrCCI-awfxhZLnjmYhfQvynumWJjz7fPxgIF-VSr4,2832
48
- brainstate/graph/_graph_operation.py,sha256=gnLZB5YLgsnwVAZugv_5sryzU9_QYyz2r0-D5y1ZG7Q,63405
48
+ brainstate/graph/_graph_operation.py,sha256=h2rdydWr9AHBMVlyYpBN9GdbVkPIgyjsctZXa8EmxQI,63401
49
49
  brainstate/graph/_graph_operation_test.py,sha256=nxMwEoaRZpTkIeR3h_Aduuys0Bm1DRlYLd_CXkErTSg,19715
50
50
  brainstate/init/__init__.py,sha256=R1dHgub47o-WJM9QkFLc7x_Q7GsyaKKDtrRHTFPpC5g,1097
51
51
  brainstate/init/_base.py,sha256=A5VIJV_xPyCD4Lo4RXe2WPlWvADAy_UPhexuwzp-6EI,1633
@@ -54,53 +54,51 @@ brainstate/init/_random_inits.py,sha256=GYovk2h2Lc1jY5ByW4R8OoZ71jbaE3BYGTfDw4-a
54
54
  brainstate/init/_random_inits_test.py,sha256=c1pUdWXQxL-seEvjO_8fBkaDL6T63b6ALNfQrNuuBbg,5287
55
55
  brainstate/init/_regular_inits.py,sha256=tcZDTXR8jiRqERuJleg_9JRGGzJj-V3LhTMcr_gt_k0,3149
56
56
  brainstate/init/_regular_inits_test.py,sha256=bvv0AOfLOEP0BIQIBLztKw3EPyEp7n2fHW8PUrmWuHk,1820
57
- brainstate/nn/__init__.py,sha256=dUEH_S5jRTq0nY1xNkpN_4MQrmHXHGSmGp3xgGenqNc,1924
57
+ brainstate/nn/__init__.py,sha256=nDIBDlzHaBy-vk4cb7FiPO6zoNe2tI5qvHIK8O7yrOU,3721
58
58
  brainstate/nn/_collective_ops.py,sha256=rWcjqaP0rW6sXdhE0fjtDi4twmq5VvhNEg8AoiQ-tDU,17390
59
59
  brainstate/nn/_collective_ops_test.py,sha256=bwq0DApcsk0_2xpxMl0_e2cGKT63g5rSngpigCm07ps,1409
60
60
  brainstate/nn/_common.py,sha256=Pt8P1LgE0qW3QnfX8CQQGH3yZ78RL7NkIqqYEw_z8xs,7096
61
+ brainstate/nn/_conv.py,sha256=Zk-yj34n6CkjntcM9xpMGLTxKNfWdIWsTsoGbtdL0yU,18448
62
+ brainstate/nn/_conv_test.py,sha256=2lcUTG7twkyhuyKwuBux-NgU8NU_W4Cp1-G8EyDJ_uk,8862
63
+ brainstate/nn/_delay.py,sha256=l36FBgNhfL64tM3VGOsJNTtKr44HjxxtBWMFFCm3Pks,17361
64
+ brainstate/nn/_dropout.py,sha256=Dq3hQrOBT6gODlDbcoag6zLGXTU_p_2MhnmVsV57Hds,17783
65
+ brainstate/nn/_dropout_test.py,sha256=9i2ZW5by0S9zfVHmZKLN0WpI1bXH6h9-QLXamG6lVXA,4432
66
+ brainstate/nn/_dynamics.py,sha256=Rx4Hwl87H94DgMM644hDi3nN9D0wvXkpWrog_Ek1sr4,47734
67
+ brainstate/nn/_dynamics_test.py,sha256=w7AV57LdhbBNYprdFpKq8MFSCbXKVkGgp_NbL3ANX3I,2769
68
+ brainstate/nn/_elementwise.py,sha256=4czeJWGQopV49iZo8DuN_WzAbXoMC1gtqaGjlON6e7c,33291
69
+ brainstate/nn/_elementwise_test.py,sha256=_dd9eX2ZJ7p24ahuoapCaRTZ0g1boufXMyqHFx1d4WY,5688
70
+ brainstate/nn/_embedding.py,sha256=SaAJbgXmuJ8XlCOX9ob4yvmgh9Fk627wMguRzJMJ1H8,2138
61
71
  brainstate/nn/_exp_euler.py,sha256=ndDB43PM4jsZKu_zdLTZ2-ojnuNrg55LZap23oBTtdA,3493
62
72
  brainstate/nn/_exp_euler_test.py,sha256=XD--qMbGHrHa3WtcPMmJKk59giDcEhSqZuBOmTNYUr8,1227
63
- brainstate/nn/_module.py,sha256=ksbmO_-bZzaP8XTRAcN2oi2ZMdSuSv-XVeWc2VJncVc,12808
73
+ brainstate/nn/_fixedprob.py,sha256=KGXohiU0wZnFIQDuwiRUTFsbsr8R0p8zgi5UZDuv1Bk,10004
74
+ brainstate/nn/_fixedprob_test.py,sha256=qbRBh-MpMtEOsg492gFu2w9-FOP9z_bXapm-Q0gLLYM,3929
75
+ brainstate/nn/_inputs.py,sha256=wPOfPE4IesNoDmxZJxqR0siBlJioEX-_1IZ2cltAIpM,20605
76
+ brainstate/nn/_linear.py,sha256=5WuhcqU-uBUC91vnwezQYMHPKmlZPDgIJ5UpffxoX1I,14472
77
+ brainstate/nn/_linear_mv.py,sha256=6hDXx4yPqRSa7uIsW9f9eJuy23dcXN9Mp2_lSvw8BDA,2635
78
+ brainstate/nn/_linear_mv_test.py,sha256=ZCM1Zy6mImQfCfdZOGnTwkiLLPXK5yalv1Ts9sWZuPA,3864
79
+ brainstate/nn/_linear_test.py,sha256=eIS-VCR3QmXB_byO1Uexg65Pv48CBRUA_Je-UGrFVTY,2925
80
+ brainstate/nn/_ltp.py,sha256=_najNUyfaFYcOlUTm7ThJopInbos3kwJyrm-QUfI-hc,861
81
+ brainstate/nn/_module.py,sha256=tleUiEd3ytEx4fZLu9NButELVlbKZNIQbXX78bdK8QU,12770
64
82
  brainstate/nn/_module_test.py,sha256=_RKHY8LHg6nbFHkvPAsEPVpp9rW6XfrcF8YD68u4o4w,8956
83
+ brainstate/nn/_neuron.py,sha256=2walTScvL034LS53pArDASXz6z26SSPbmCvchWWjkUU,27441
84
+ brainstate/nn/_neuron_test.py,sha256=QF8pixUqA5Oj7MrNi2NR8VAnfGpAvNpwV2mBc3e_pTY,6393
85
+ brainstate/nn/_normalizations.py,sha256=4B1YVI6AZyJLHseJK9eiSeMOIq--0ZuDG58iC9mrekE,37387
86
+ brainstate/nn/_normalizations_test.py,sha256=JTqpH265GT0eKw3hXmT0qC8ZM5NkUe98of0uYS7_5Us,2456
87
+ brainstate/nn/_poolings.py,sha256=h5aIj_K3X2HSMjrOtkgwiCpvLxfXXEUvFFa57Cxp5bI,46969
88
+ brainstate/nn/_poolings_test.py,sha256=qje9PVWvPGiYOv6UlTEWfpqqjpv4Xop5rO0ATcgcF0w,7497
89
+ brainstate/nn/_projection.py,sha256=_TW-YmfPqUDkekMMK7tXrdLbjT4Ou2sUAecTNNn7FVM,17498
90
+ brainstate/nn/_rate_rnns.py,sha256=OQHMyq9kKd2q44dOHLuTqHKTGuraPMqXVutFP_LYIyU,20676
91
+ brainstate/nn/_rate_rnns_test.py,sha256=__hhx7e6LX_1mDLLQyIi4TNCaFAWnOVSTIgwHNjzf2g,2444
92
+ brainstate/nn/_readout.py,sha256=OJjSba5Wr7dtUXqYhAv1D7BUGOI-lAmg6urxPBrZe3c,7116
93
+ brainstate/nn/_readout_test.py,sha256=L2T0-SkiACxkY_I5Pbnbmy0Zw3tbpV3l5xVzAw42f2g,2136
94
+ brainstate/nn/_stp.py,sha256=-ahDEqSp8bQsU_nUK4jks8fjMYKgIbO0v7zpyGVuXtA,8645
95
+ brainstate/nn/_synapse.py,sha256=liKhmHZFQpEdu1R76AljeJMAKz5HK8Yq95ENa6FLVAc,20145
96
+ brainstate/nn/_synapse_test.py,sha256=xmCWFxZUIM2YtmW5otKnADGCCK__4JpXmSYcZ3wzlQM,4994
97
+ brainstate/nn/_synaptic_projection.py,sha256=UFgzsMB1VZ9ieumwmaTIC7irLrZ4pmwfiuOYomkwXG4,17917
98
+ brainstate/nn/_synouts.py,sha256=jWQP1-qXFpdYgyUSJNFD7_bk4_-67ok36br-OzbcSXY,4524
99
+ brainstate/nn/_synouts_test.py,sha256=sfjotlS--4hT22Vb5RfmpfmXABa8z-VdxZYUSocMmlU,2244
65
100
  brainstate/nn/_utils.py,sha256=epfELIy1COgdS9z5be-fmbFhagNugcIHpw4ww-HlkSY,3123
66
101
  brainstate/nn/metrics.py,sha256=TXCB_yGQzamklJCI5FGOAZ5dihtY-gjYlSi2SCLC3LA,14700
67
- brainstate/nn/_dyn_impl/__init__.py,sha256=J1hMqNey1921tZppCjuHApB6oc-5aGhWXyOXh96CeWM,1322
68
- brainstate/nn/_dyn_impl/_dynamics_neuron.py,sha256=6xsGF2Oy_oD6bcTdfwqnHBtfdAJREIl5qvNUZKZRlnQ,27482
69
- brainstate/nn/_dyn_impl/_dynamics_neuron_test.py,sha256=QF8pixUqA5Oj7MrNi2NR8VAnfGpAvNpwV2mBc3e_pTY,6393
70
- brainstate/nn/_dyn_impl/_dynamics_synapse.py,sha256=b2QMEzasbXTp7k1XWNg7nRt4-WddCym0CSEErjPRIWA,27449
71
- brainstate/nn/_dyn_impl/_dynamics_synapse_test.py,sha256=xmCWFxZUIM2YtmW5otKnADGCCK__4JpXmSYcZ3wzlQM,4994
72
- brainstate/nn/_dyn_impl/_inputs.py,sha256=Fe3tgSwJMrq2HfZJq9CTgNy24Ji6tnLCqB4hkhaY_K0,20675
73
- brainstate/nn/_dyn_impl/_rate_rnns.py,sha256=SXlrHZhih4LD99Jg8OwIWur5UQbd6E_zotkHvkFFstc,20715
74
- brainstate/nn/_dyn_impl/_rate_rnns_test.py,sha256=__hhx7e6LX_1mDLLQyIi4TNCaFAWnOVSTIgwHNjzf2g,2444
75
- brainstate/nn/_dyn_impl/_readout.py,sha256=UzaJ6WIMpNjqHolhjHTpyCZ5E2nSDucvuV5PBW7rOPs,7151
76
- brainstate/nn/_dyn_impl/_readout_test.py,sha256=L2T0-SkiACxkY_I5Pbnbmy0Zw3tbpV3l5xVzAw42f2g,2136
77
- brainstate/nn/_dynamics/__init__.py,sha256=j1HSWu01wf5-KjSaNhBC9utVGDALOhUsFPrLPcPPDsM,1208
78
- brainstate/nn/_dynamics/_dynamics_base.py,sha256=stBAkb8f973vJe66p0tve-0AO_j008BCpAA96FIPnTI,43363
79
- brainstate/nn/_dynamics/_dynamics_base_test.py,sha256=w7AV57LdhbBNYprdFpKq8MFSCbXKVkGgp_NbL3ANX3I,2769
80
- brainstate/nn/_dynamics/_projection_base.py,sha256=O86VfZkd8Qd5_8CDK-4eCGS6Jkp1CKyW6J9__bQnmo0,12893
81
- brainstate/nn/_dynamics/_state_delay.py,sha256=kSgel1OSFB92WcfGTsIjgb-KW389ydXTcLbTUjylU-A,16867
82
- brainstate/nn/_dynamics/_synouts.py,sha256=Py9DM3o-JmkoqYyQM5vl89-SBqTBRdk2CUYgYHYu3No,4453
83
- brainstate/nn/_dynamics/_synouts_test.py,sha256=sfjotlS--4hT22Vb5RfmpfmXABa8z-VdxZYUSocMmlU,2244
84
- brainstate/nn/_elementwise/__init__.py,sha256=PK8oq1K_EG2941AiUyLxCWoRdWvMO3yt8ZJbw3Lkhu8,935
85
- brainstate/nn/_elementwise/_dropout.py,sha256=ymr87YYA5x5C_c9HzNLGPJK_ebJ22Y-KsK-gZJY_2MU,17733
86
- brainstate/nn/_elementwise/_dropout_test.py,sha256=9i2ZW5by0S9zfVHmZKLN0WpI1bXH6h9-QLXamG6lVXA,4432
87
- brainstate/nn/_elementwise/_elementwise.py,sha256=yO6BukJFLfnICPELEFp2kfutFM8Jeg7TaERXFp-aNrk,33304
88
- brainstate/nn/_elementwise/_elementwise_test.py,sha256=_dd9eX2ZJ7p24ahuoapCaRTZ0g1boufXMyqHFx1d4WY,5688
89
- brainstate/nn/_event/__init__.py,sha256=OLteeA3d1Kq8yi3XETA-rFYtYpojZRpY1J_h5MpH3rY,919
90
- brainstate/nn/_event/_fixedprob_mv.py,sha256=MpVCiYGiDC8GAuJWtYXKrpzP9yDtnYHolHlwyzoQ1r4,6619
91
- brainstate/nn/_event/_fixedprob_mv_test.py,sha256=qbRBh-MpMtEOsg492gFu2w9-FOP9z_bXapm-Q0gLLYM,3929
92
- brainstate/nn/_event/_linear_mv.py,sha256=KslIdse7KZ7FWm5qcOMC-COM__1rB-sUJmXvlXY11y8,2683
93
- brainstate/nn/_event/_linear_mv_test.py,sha256=ZCM1Zy6mImQfCfdZOGnTwkiLLPXK5yalv1Ts9sWZuPA,3864
94
- brainstate/nn/_interaction/__init__.py,sha256=TTY_SeNrdx4VnUSw6vdyl02OHdS9Qs15cWBp6kjsyNQ,1289
95
- brainstate/nn/_interaction/_conv.py,sha256=QMZR4HRAYe8Nzr3qExp0PWr6wuUp2rh5YxmPq1r1vcY,18461
96
- brainstate/nn/_interaction/_conv_test.py,sha256=2lcUTG7twkyhuyKwuBux-NgU8NU_W4Cp1-G8EyDJ_uk,8862
97
- brainstate/nn/_interaction/_embedding.py,sha256=8HC-J3RhvGGrvqA0-BBaFDk6tmlunPP6bNohjRSQzYo,2151
98
- brainstate/nn/_interaction/_linear.py,sha256=jk765kASgwVG1r-xjoM49Thfa1Cu32mscy7ci79bjDI,14729
99
- brainstate/nn/_interaction/_linear_test.py,sha256=eIS-VCR3QmXB_byO1Uexg65Pv48CBRUA_Je-UGrFVTY,2925
100
- brainstate/nn/_interaction/_normalizations.py,sha256=4yoU04wK21_zk6Egpwb9YN_pSWUH5Qa6hJ1bLxX7wQw,37400
101
- brainstate/nn/_interaction/_normalizations_test.py,sha256=JTqpH265GT0eKw3hXmT0qC8ZM5NkUe98of0uYS7_5Us,2456
102
- brainstate/nn/_interaction/_poolings.py,sha256=2hJDACuHv3CkO-nyyAqVZp7Sa3UFa_ROFGiYmhXWqKk,46982
103
- brainstate/nn/_interaction/_poolings_test.py,sha256=7-jEs_UcMNWm8q6NbrRRX3bTn14jBjGiAX0KBaROng0,7510
104
102
  brainstate/optim/__init__.py,sha256=7Ao0LCtDNAoxSRSXiLLKnd1_4mR2GSExizpN38il-Fo,1195
105
103
  brainstate/optim/_base.py,sha256=P37k8w46iQZZZnFLa5OF83Sb8DLQfYMez9ZRObBqVsE,1835
106
104
  brainstate/optim/_lr_scheduler.py,sha256=0t7kl35MLmc0UcSu587nI28cI3SohYhy_19Al-5dNTM,15289
@@ -115,19 +113,19 @@ brainstate/random/_rand_seed.py,sha256=1ZdfFZWyOhpd72EDdEDmpkp3yoLVwdv-sGI9BwiZf
115
113
  brainstate/random/_rand_seed_test.py,sha256=waXXfch57X1XE1zDnCRokT6ziZOK0g-lYE80o6epDYM,1536
116
114
  brainstate/random/_rand_state.py,sha256=dTO7wqmuTYRdPy7ItsrK-7aNt5QQXOsZ4XwiH7mzmy8,55170
117
115
  brainstate/random/_random_for_unit.py,sha256=kGp4EUX19MXJ9Govoivbg8N0bddqOldKEI2h_TbdONY,2057
118
- brainstate/util/__init__.py,sha256=zwdw0253tY2kgWHHPPwaU6JHvjw4rioUnRmSAWF4Po0,1569
119
- brainstate/util/_caller.py,sha256=RBRwu1HT_Lww7EE3WTjzrwwKqVWg7dn_JXKmO9ojM38,2752
120
- brainstate/util/_error.py,sha256=GBLaU_glQlgdrjBYIMiO3Dy5N_ST6-QNsgAOa9kjUjw,1757
121
- brainstate/util/_others.py,sha256=vGo4uW0vd7wL5DYtxKWqXhoNmI-O_p26HsucoMnhdVA,16407
122
- brainstate/util/_pretty_pytree.py,sha256=PHMiES2vN_bke_GeHaSYHQZUtXtR-HkcMch8HQJ8Cw8,33536
116
+ brainstate/util/__init__.py,sha256=6efwr63osmqviNU_6_Nufag19PwxRDFvDAZrq6sH5yo,1555
123
117
  brainstate/util/_pretty_pytree_test.py,sha256=Dn0TdjX6wLBXaTD4jfYTu6cKfFHwKSxi4_3bX7kB_IA,5621
124
- brainstate/util/_pretty_repr.py,sha256=7Xp7IFNUeP7cGlpvwwJyBslbQVnXEqC1I6neV1Jx1S8,10527
125
- brainstate/util/_pretty_table.py,sha256=uJVaamFGQ4nKP8TkEGPWXHpzjMecDo2q1Ah6XtRjdPY,108117
126
- brainstate/util/_scaling.py,sha256=U6DM-afPrLejiGqo1Nla7z4YbTBVicctsBEweurr_mk,7524
127
- brainstate/util/_struct.py,sha256=7HbbQNrZ3zxYw93MU1bUZ9ZPBKftYOVKuXEochLSErw,17479
118
+ brainstate/util/caller.py,sha256=RBRwu1HT_Lww7EE3WTjzrwwKqVWg7dn_JXKmO9ojM38,2752
119
+ brainstate/util/error.py,sha256=GBLaU_glQlgdrjBYIMiO3Dy5N_ST6-QNsgAOa9kjUjw,1757
128
120
  brainstate/util/filter.py,sha256=skuq51y0P5-N611fQ-zB2QyaJIFqN_WbROzZHv0RgOc,14086
129
- brainstate-0.1.2.dist-info/LICENSE,sha256=VZe9u1jgUL2eCY6ZPOYgdb8KCblCHt8ECdbtJid6e1s,11550
130
- brainstate-0.1.2.dist-info/METADATA,sha256=Mv44muheQeXJ67RF5GQrkSxVWfj4VAZnkse6_7z5OTY,4135
131
- brainstate-0.1.2.dist-info/WHEEL,sha256=bb2Ot9scclHKMOLDEHY6B2sicWOgugjFKaJsT7vwMQo,110
132
- brainstate-0.1.2.dist-info/top_level.txt,sha256=eQbGgKn0ptx7FDWuua0V0wr4K1VHi2iOUCYo3fUQBRA,11
133
- brainstate-0.1.2.dist-info/RECORD,,
121
+ brainstate/util/others.py,sha256=vGo4uW0vd7wL5DYtxKWqXhoNmI-O_p26HsucoMnhdVA,16407
122
+ brainstate/util/pretty_pytree.py,sha256=HmXZpKGps1Rs0DEN7r1eYN6xMM6FgDpCC8SdEHjOsvo,33534
123
+ brainstate/util/pretty_repr.py,sha256=7Xp7IFNUeP7cGlpvwwJyBslbQVnXEqC1I6neV1Jx1S8,10527
124
+ brainstate/util/pretty_table.py,sha256=uJVaamFGQ4nKP8TkEGPWXHpzjMecDo2q1Ah6XtRjdPY,108117
125
+ brainstate/util/scaling.py,sha256=U6DM-afPrLejiGqo1Nla7z4YbTBVicctsBEweurr_mk,7524
126
+ brainstate/util/struct.py,sha256=7HbbQNrZ3zxYw93MU1bUZ9ZPBKftYOVKuXEochLSErw,17479
127
+ brainstate-0.1.4.dist-info/LICENSE,sha256=VZe9u1jgUL2eCY6ZPOYgdb8KCblCHt8ECdbtJid6e1s,11550
128
+ brainstate-0.1.4.dist-info/METADATA,sha256=EWarKpuYFIN0ITFn8lwsUy0h9-KjrVPDwcvjQMHFRto,4135
129
+ brainstate-0.1.4.dist-info/WHEEL,sha256=bb2Ot9scclHKMOLDEHY6B2sicWOgugjFKaJsT7vwMQo,110
130
+ brainstate-0.1.4.dist-info/top_level.txt,sha256=eQbGgKn0ptx7FDWuua0V0wr4K1VHi2iOUCYo3fUQBRA,11
131
+ brainstate-0.1.4.dist-info/RECORD,,
@@ -1,42 +0,0 @@
1
- # Copyright 2024 BDP Ecosystem Limited. All Rights Reserved.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
- # ==============================================================================
15
-
16
-
17
- from ._dynamics_neuron import *
18
- from ._dynamics_neuron import __all__ as dyn_neuron_all
19
- from ._dynamics_synapse import *
20
- from ._dynamics_synapse import __all__ as dyn_synapse_all
21
- from ._inputs import *
22
- from ._inputs import __all__ as inputs_all
23
- from ._rate_rnns import *
24
- from ._rate_rnns import __all__ as rate_rnns
25
- from ._readout import *
26
- from ._readout import __all__ as readout_all
27
-
28
- __all__ = (
29
- dyn_neuron_all
30
- + dyn_synapse_all
31
- + inputs_all
32
- + rate_rnns
33
- + readout_all
34
- )
35
-
36
- del (
37
- dyn_neuron_all,
38
- dyn_synapse_all,
39
- inputs_all,
40
- readout_all,
41
- rate_rnns,
42
- )
@@ -1,37 +0,0 @@
1
- # Copyright 2024 BDP Ecosystem Limited. All Rights Reserved.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
- # ==============================================================================
15
-
16
- from ._dynamics_base import *
17
- from ._dynamics_base import __all__ as dyn_all
18
- from ._projection_base import *
19
- from ._projection_base import __all__ as projection_all
20
- from ._state_delay import *
21
- from ._state_delay import __all__ as state_delay_all
22
- from ._synouts import *
23
- from ._synouts import __all__ as synouts_all
24
-
25
- __all__ = (
26
- dyn_all
27
- + projection_all
28
- + state_delay_all
29
- + synouts_all
30
- )
31
-
32
- del (
33
- dyn_all,
34
- projection_all,
35
- state_delay_all,
36
- synouts_all
37
- )
@@ -1,362 +0,0 @@
1
- # Copyright 2024 BDP Ecosystem Limited. All Rights Reserved.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
- # ==============================================================================
15
-
16
- from typing import Union, Callable, Optional
17
-
18
- from brainstate._state import State
19
- from brainstate.mixin import AlignPost, ParamDescriber, BindCondData, JointTypes
20
- from brainstate.nn._collective_ops import call_order
21
- from brainstate.nn._module import Module
22
- from brainstate.util._others import get_unique_name
23
- from ._dynamics_base import Dynamics, maybe_init_prefetch, Prefetch, PrefetchDelayAt
24
- from ._synouts import SynOut
25
-
26
- __all__ = [
27
- 'AlignPostProj',
28
- 'DeltaProj',
29
- 'CurrentProj',
30
- ]
31
-
32
-
33
- class Interaction(Module):
34
- __module__ = 'brainstate.nn'
35
-
36
-
37
- def _check_modules(*modules):
38
- # checking modules
39
- for module in modules:
40
- if not callable(module) and not isinstance(module, State):
41
- raise TypeError(
42
- f'The module should be a callable function or a brainstate.State, but got {module}.'
43
- )
44
- return tuple(modules)
45
-
46
-
47
- def call_module(module, *args, **kwargs):
48
- if callable(module):
49
- return module(*args, **kwargs)
50
- elif isinstance(module, State):
51
- return module.value
52
- else:
53
- raise TypeError(
54
- f'The module should be a callable function or a brainstate.State, but got {module}.'
55
- )
56
-
57
-
58
- def is_instance(x, cls) -> bool:
59
- return isinstance(x, cls)
60
-
61
-
62
- def get_post_repr(label, syn, out):
63
- if label is None:
64
- return f'{syn.identifier} // {out.identifier}'
65
- else:
66
- return f'{label}{syn.identifier} // {out.identifier}'
67
-
68
-
69
- def align_post_add_bef_update(
70
- syn_desc: ParamDescriber[AlignPost],
71
- out_desc: ParamDescriber[BindCondData],
72
- post: Dynamics,
73
- proj_name: str,
74
- label: str,
75
- ):
76
- # synapse and output initialization
77
- _post_repr = get_post_repr(label, syn_desc, out_desc)
78
- if not post._has_before_update(_post_repr):
79
- syn_cls = syn_desc()
80
- out_cls = out_desc()
81
-
82
- # synapse and output initialization
83
- post.add_current_input(proj_name, out_cls, label=label)
84
- post._add_before_update(_post_repr, _AlignPost(syn_cls, out_cls))
85
- syn = post._get_before_update(_post_repr).syn
86
- out = post._get_before_update(_post_repr).out
87
- return syn, out
88
-
89
-
90
- class _AlignPost(Module):
91
- def __init__(
92
- self,
93
- syn: Dynamics,
94
- out: BindCondData
95
- ):
96
- super().__init__()
97
- self.syn = syn
98
- self.out = out
99
-
100
- def update(self, *args, **kwargs):
101
- self.out.bind_cond(self.syn(*args, **kwargs))
102
-
103
-
104
- class AlignPostProj(Interaction):
105
- """
106
- Align-post projection of the neural network.
107
-
108
-
109
- Examples
110
- --------
111
-
112
- Here is an example of using the `AlignPostProj` to create a synaptic projection.
113
- Note that this projection needs the manual input of pre-synaptic spikes.
114
-
115
- >>> import brainstate
116
- >>> import brainevent
117
- >>> import brainunit as u
118
- >>> n_exc = 3200
119
- >>> n_inh = 800
120
- >>> num = n_exc + n_inh
121
- >>> pop = brainstate.nn.LIFRef(
122
- ... num,
123
- ... V_rest=-49. * u.mV, V_th=-50. * u.mV, V_reset=-60. * u.mV,
124
- ... tau=20. * u.ms, tau_ref=5. * u.ms,
125
- ... V_initializer=brainstate.init.Normal(-55., 2., unit=u.mV)
126
- ... )
127
- >>> pop.reset_state()
128
- >>> E = brainstate.nn.AlignPostProj(
129
- ... comm=brainevent.nn.FixedProb(n_exc, num, prob=80 / num, weight=1.62 * u.mS),
130
- ... syn=brainstate.nn.Expon.desc(num, tau=5. * u.ms),
131
- ... out=brainstate.nn.CUBA.desc(scale=u.volt),
132
- ... post=pop
133
- ... )
134
- >>> exe_current = E(pop.spike.value)
135
-
136
-
137
-
138
- """
139
- __module__ = 'brainstate.nn'
140
-
141
- def __init__(
142
- self,
143
- *modules,
144
- comm: Callable,
145
- syn: Union[ParamDescriber[AlignPost], AlignPost],
146
- out: Union[ParamDescriber[SynOut], SynOut],
147
- post: Dynamics,
148
- label: Optional[str] = None,
149
- ):
150
- super().__init__(name=get_unique_name(self.__class__.__name__))
151
-
152
- # checking modules
153
- self.modules = _check_modules(*modules)
154
-
155
- # checking communication model
156
- if not callable(comm):
157
- raise TypeError(
158
- f'The communication should be an instance of callable function, but got {comm}.'
159
- )
160
-
161
- # checking synapse and output models
162
- if is_instance(syn, ParamDescriber[AlignPost]):
163
- if not is_instance(out, ParamDescriber[SynOut]):
164
- if is_instance(out, ParamDescriber):
165
- raise TypeError(
166
- f'The output should be an instance of describer {ParamDescriber[SynOut]} when '
167
- f'the synapse is an instance of {AlignPost}, but got {out}.'
168
- )
169
- raise TypeError(
170
- f'The output should be an instance of describer {ParamDescriber[SynOut]} when '
171
- f'the synapse is a describer, but we got {out}.'
172
- )
173
- merging = True
174
- else:
175
- if is_instance(syn, ParamDescriber):
176
- raise TypeError(
177
- f'The synapse should be an instance of describer {ParamDescriber[AlignPost]}, but got {syn}.'
178
- )
179
- if not is_instance(out, SynOut):
180
- raise TypeError(
181
- f'The output should be an instance of {SynOut} when the synapse is '
182
- f'not a describer, but we got {out}.'
183
- )
184
- merging = False
185
- self.merging = merging
186
-
187
- # checking post model
188
- if not is_instance(post, Dynamics):
189
- raise TypeError(
190
- f'The post should be an instance of {Dynamics}, but got {post}.'
191
- )
192
-
193
- if merging:
194
- # synapse and output initialization
195
- syn, out = align_post_add_bef_update(syn_desc=syn,
196
- out_desc=out,
197
- post=post,
198
- proj_name=self.name,
199
- label=label)
200
- else:
201
- post.add_current_input(self.name, out)
202
-
203
- # references
204
- self.comm = comm
205
- self.syn: JointTypes[Dynamics, AlignPost] = syn
206
- self.out: BindCondData = out
207
- self.post: Dynamics = post
208
-
209
- @call_order(2)
210
- def init_state(self, *args, **kwargs):
211
- for module in self.modules:
212
- maybe_init_prefetch(module, *args, **kwargs)
213
-
214
- def update(self, *args):
215
- # call all modules
216
- for module in self.modules:
217
- x = call_module(module, *args)
218
- args = (x,)
219
- # communication module
220
- x = self.comm(*args)
221
- # add synapse input
222
- self.syn.add_delta_input(self.name, x)
223
- if not self.merging:
224
- # synapse and output interaction
225
- conductance = self.syn()
226
- self.out.bind_cond(conductance)
227
-
228
-
229
- class DeltaProj(Interaction):
230
- r"""Full-chain of the synaptic projection for the Delta synapse model.
231
-
232
- The synaptic projection requires the input is the spiking data, otherwise
233
- the synapse is not the Delta synapse model.
234
-
235
- The ``full-chain`` means that the model needs to provide all information needed for a projection,
236
- including ``pre`` -> ``delay`` -> ``comm`` -> ``post``.
237
-
238
- **Model Descriptions**
239
-
240
- .. math::
241
-
242
- I_{syn} (t) = \sum_{j\in C} g_{\mathrm{max}} * \delta(t-t_j-D)
243
-
244
- where :math:`g_{\mathrm{max}}` denotes the chemical synaptic strength,
245
- :math:`t_j` the spiking moment of the presynaptic neuron :math:`j`,
246
- :math:`C` the set of neurons connected to the post-synaptic neuron,
247
- and :math:`D` the transmission delay of chemical synapses.
248
- For simplicity, the rise and decay phases of post-synaptic currents are
249
- omitted in this model.
250
-
251
- # brainstate.nn.DeltaInteraction(
252
- # LIF().prefetch('V'), bst.surrogate.ReluGrad(), comm, post
253
- # )
254
-
255
- Args:
256
- pre: The pre-synaptic neuron group.
257
- delay: The synaptic delay.
258
- comm: DynamicalSystem. The synaptic communication.
259
- post: DynamicalSystem. The post-synaptic neuron group.
260
- """
261
-
262
- __module__ = 'brainstate.nn'
263
-
264
- def __init__(self, *modules, comm: Callable, post: Dynamics, label=None):
265
- super().__init__(name=get_unique_name(self.__class__.__name__))
266
-
267
- self.label = label
268
-
269
- # checking modules
270
- self.modules = _check_modules(*modules)
271
-
272
- # checking communication model
273
- if not callable(comm):
274
- raise TypeError(
275
- f'The communication should be an instance of callable function, but got {comm}.'
276
- )
277
- self.comm = comm
278
-
279
- # post model
280
- if not isinstance(post, Dynamics):
281
- raise TypeError(
282
- f'The post should be an instance of {Dynamics}, but got {post}.'
283
- )
284
- self.post = post
285
-
286
- @call_order(2)
287
- def init_state(self, *args, **kwargs):
288
- for module in self.modules:
289
- maybe_init_prefetch(module, *args, **kwargs)
290
-
291
- def update(self, *x):
292
- for module in self.modules:
293
- x = (call_module(module, *x),)
294
- assert len(x) == 1, f'The output of the modules should be a single value, but got {x}.'
295
- x = self.comm(x[0])
296
- self.post.add_delta_input(self.name, x, label=self.label)
297
-
298
-
299
- class CurrentProj(Interaction):
300
- """
301
- Full-chain synaptic projection with the align-pre reduction and delay+synapse updating and merging.
302
-
303
- The ``full-chain`` means that the model needs to provide all information needed for a projection,
304
- including ``pre`` -> ``delay`` -> ``syn`` -> ``comm`` -> ``out`` -> ``post``.
305
- Note here, compared to ``FullProjAlignPreSD``, the ``delay`` and ``syn`` are exchanged.
306
-
307
- The ``align-pre`` means that the synaptic variables have the same dimension as the pre-synaptic neuron group.
308
-
309
- The ``delay+synapse updating`` means that the projection first delivers the pre neuron output (usually the
310
- spiking) to the delay model, then computes the synapse states, and finally computes the synaptic current.
311
-
312
- The ``merging`` means that the same delay model is shared by all synapses, and the synapse model with same
313
- parameters (such like time constants) will also share the same synaptic variables.
314
-
315
- Neither ``FullProjAlignPreDS`` nor ``FullProjAlignPreSD`` facilitates the event-driven computation.
316
- This is because the ``comm`` is computed after the synapse state, which is a floating-point number, rather
317
- than the spiking. To facilitate the event-driven computation, please use align post projections.
318
-
319
- Args:
320
- prefetch: The synaptic dynamics.
321
- comm: The synaptic communication.
322
- out: The synaptic output.
323
- post: The post-synaptic neuron group.
324
- """
325
- __module__ = 'brainstate.nn'
326
-
327
- def __init__(
328
- self,
329
- prefetch: Union[Prefetch, PrefetchDelayAt],
330
- comm: Callable,
331
- out: SynOut,
332
- post: Dynamics,
333
- ):
334
- super().__init__(name=get_unique_name(self.__class__.__name__))
335
-
336
- # pre-synaptic neuron group
337
- if not isinstance(prefetch, (Prefetch, PrefetchDelayAt)):
338
- raise TypeError(f'The pre should be a Prefetch or PrefetchDelayAt, but got {prefetch}.')
339
- self.prefetch = prefetch
340
-
341
- # check out
342
- if not isinstance(out, SynOut):
343
- raise TypeError(f'The out should be a SynOut, but got {out}.')
344
- self.out = out
345
-
346
- # check post
347
- if not isinstance(post, Dynamics):
348
- raise TypeError(f'The post should be a Dynamics, but got {post}.')
349
- self.post = post
350
- post.add_current_input(self.name, out)
351
-
352
- # output initialization
353
- self.comm = comm
354
-
355
- @call_order(2)
356
- def init_state(self, *args, **kwargs):
357
- maybe_init_prefetch(self.prefetch, *args, **kwargs)
358
-
359
- def update(self, *x):
360
- x = self.prefetch(*x)
361
- x = self.comm(x)
362
- self.out.bind_cond(x)
@@ -1,22 +0,0 @@
1
- # Copyright 2024 BDP Ecosystem Limited. All Rights Reserved.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
- # ==============================================================================
15
-
16
- from ._dropout import *
17
- from ._dropout import __all__ as dropout_all
18
- from ._elementwise import *
19
- from ._elementwise import __all__ as elementwise_all
20
-
21
- __all__ = dropout_all + elementwise_all
22
- del dropout_all, elementwise_all