@@ -18,31 +18,33 @@ class ExponentialSynapse(DenseSynapse): ## dynamic exponential synapse cable
18
18
19
19
20
20
| --- Synapse Compartments: ---
21
- | inputs - input (takes in external signals)
22
- | outputs - output signals
21
+ | inputs - input (takes in external signals, e.g., pre-synaptic pulses/spikes)
22
+ | outputs - output signals (also equal to i_syn, total electrical current)
23
+ | v - coupled voltages from post-synaptic neurons this synaptic cable connects to
23
24
| weights - current value matrix of synaptic efficacies
24
25
| biases - current value vector of synaptic bias values
25
- | --- Short-Term Plasticity Compartments: ---
26
- | resources - fixed value matrix of synaptic resources (U)
27
- | u - release probability; fraction of resources ready for use
28
- | x - fraction of resources available after neurotransmitter depletion
29
-
30
- | Dynamics note:
31
- | If tau_d >> tau_f and resources U are large, then synapse is STD-dominated
32
- | If tau_d << tau_f and resources U are small, then synases is STF-dominated
26
+ | --- Dynamic / Short-term Plasticity Compartments: ---
27
+ | g_syn - fixed value matrix of synaptic resources (U)
28
+ | i_syn - derived total electrical current variable
33
29
34
30
Args:
35
31
name: the string name of this cell
36
32
37
33
shape: tuple specifying shape of this synaptic cable (usually a 2-tuple
38
34
with number of inputs by number of outputs)
39
35
36
+ tau_syn: synaptic time constant (ms)
37
+
38
+ g_syn_bar: maximum conductance elicited by each incoming spike ("synaptic weight")
39
+
40
+ syn_rest: synaptic reversal potential
41
+
40
42
weight_init: a kernel to drive initialization of this synaptic cable's values;
41
43
typically a tuple with 1st element as a string calling the name of
42
44
initialization to use
43
45
44
46
bias_init: a kernel to drive initialization of biases for this synaptic cable
45
- (Default: None, which turns off/disables biases)
47
+ (Default: None, which turns off/disables biases) <unused>
46
48
47
49
resist_scale: a fixed (resistance) scaling factor to apply to synaptic
48
50
transform (Default: 1.), i.e., yields: out = ((W * Rscale) * in)
@@ -51,52 +53,56 @@ class ExponentialSynapse(DenseSynapse): ## dynamic exponential synapse cable
51
53
this to < 1 and > 0. will result in a sparser synaptic structure
52
54
(lower values yield sparse structure)
53
55
54
- tau_f: short-term facilitation (STF) time constant (default: `750` ms); note
55
- that setting this to `0` ms will disable STF
56
-
57
- tau_d: shoft-term depression time constant (default: `50` ms); note
58
- that setting this to `0` ms will disable STD
56
+ is_nonplastic: boolean indicating if this synapse permits plasticity adjustments (Default: True)
59
57
60
- resources_int: initialization kernel for synaptic resources matrix
61
58
"""
62
59
63
60
# Define Functions
64
- def __init__ (self , name , shape , weight_init = None , bias_init = None ,
65
- resist_scale = 1. , p_conn = 1. , tau_f = 750. , tau_d = 50. ,
66
- resources_init = None , ** kwargs ):
61
+ def __init__ (
62
+ self , name , shape , tau_syn , g_syn_bar , syn_rest , weight_init = None , bias_init = None , resist_scale = 1. , p_conn = 1. ,
63
+ is_nonplastic = True , ** kwargs
64
+ ):
67
65
super ().__init__ (name , shape , weight_init , bias_init , resist_scale , p_conn , ** kwargs )
68
- ## STP meta-parameters
69
- self .resources_init = resources_init
70
- self .tau_f = tau_f
71
- self .tau_d = tau_d
66
+ ## dynamic synapse meta-parameters
67
+ self .tau_syn = tau_syn
68
+ self .g_syn_bar = g_syn_bar
69
+ self .syn_rest = syn_rest ## synaptic resting potential
72
70
73
71
## Set up short-term plasticity / dynamic synapse compartment values
74
- tmp_key , * subkeys = random .split (self .key .value , 4 )
75
- preVals = jnp .zeros ((self .batch_size , shape [0 ]))
76
- self .i = Compartment (preVals ) ## electrical current output
77
- self .g = Compartment (preVals ) ## conductance variable
78
-
79
-
80
- @transition (output_compartments = ["outputs" , "i" , "g" ])
72
+ #tmp_key, *subkeys = random.split(self.key.value, 4)
73
+ #preVals = jnp.zeros((self.batch_size, shape[0]))
74
+ postVals = jnp .zeros ((self .batch_size , shape [1 ]))
75
+ self .v = Compartment (postVals ) ## coupled voltage (from a post-synaptic neuron)
76
+ self .i_syn = Compartment (postVals ) ## electrical current output
77
+ self .g_syn = Compartment (postVals ) ## conductance variable
78
+ if is_nonplastic :
79
+ self .weights .set (self .weights * 0 + 1. )
80
+
81
+ @transition (output_compartments = ["outputs" , "i_syn" , "g_syn" ])
81
82
@staticmethod
82
83
def advance_state (
83
- tau_f , tau_d , Rscale , inputs , weights , biases , i , g
84
+ dt , tau_syn , g_syn_bar , syn_rest , Rscale , inputs , weights , i_syn , g_syn , v
84
85
):
85
86
s = inputs
86
-
87
- outputs = None #jnp.matmul(inputs, Wdyn * Rscale) + biases
88
- return outputs
89
-
90
- @transition (output_compartments = ["inputs" , "outputs" , "i" , "g" ])
87
+ ## advance conductance variable
88
+ _out = jnp .matmul (s , weights ) ## sum all pre-syn spikes at t going into post-neuron)
89
+ dgsyn_dt = _out * g_syn_bar - g_syn / tau_syn
90
+ g_syn = g_syn + dgsyn_dt * dt ## run Euler step to move conductance
91
+ i_syn = g_syn * (v - syn_rest )
92
+ outputs = i_syn #jnp.matmul(inputs, Wdyn * Rscale) + biases
93
+ return outputs , i_syn , g_syn
94
+
95
+ @transition (output_compartments = ["inputs" , "outputs" , "i_syn" , "g_syn" , "v" ])
91
96
@staticmethod
92
97
def reset (batch_size , shape ):
93
98
preVals = jnp .zeros ((batch_size , shape [0 ]))
94
99
postVals = jnp .zeros ((batch_size , shape [1 ]))
95
100
inputs = preVals
96
101
outputs = postVals
97
- i = preVals
98
- g = preVals
99
- return inputs , outputs , i , g
102
+ i_syn = postVals
103
+ g_syn = postVals
104
+ v = postVals
105
+ return inputs , outputs , i_syn , g_syn , v
100
106
101
107
def save (self , directory , ** kwargs ):
102
108
file_name = directory + "/" + self .name + ".npz"
@@ -135,11 +141,14 @@ def help(cls): ## component help function
135
141
"bias_init" : "Initialization conditions for bias/base-rate (b) values" ,
136
142
"resist_scale" : "Resistance level scaling factor (applied to output of transformation)" ,
137
143
"p_conn" : "Probability of a connection existing (otherwise, it is masked to zero)" ,
144
+ "tau_syn" : "Synaptic time constant (ms)" ,
145
+ "g_bar_syn" : "Maximum conductance value" ,
146
+ "syn_rest" : "Synaptic reversal potential"
138
147
}
139
148
info = {cls .__name__ : properties ,
140
149
"compartments" : compartment_props ,
141
- "dynamics" : "outputs = [(W * Rscale) * inputs] + b ; "
142
- "dg/dt = " ,
150
+ "dynamics" : "outputs = g_syn * (v - syn_rest) ; "
151
+ "dgsyn_dt = (W * inputs) * g_syn_bar - g_syn/tau_syn " ,
143
152
"hyperparameters" : hyperparams }
144
153
return info
145
154
0 commit comments