Constructor for class ``DiehlAndCook2015``. :param n_inpt: Number of input neurons. Matches the 1D size of the input data. :param n_neurons: Number of excitatory, inhibitory neurons. :param exc: Strength of synapse weights from excitatory to inhibitory layer.
(
self,
n_inpt: int,
device: str = "cpu",
batch_size: int = None,
sparse: bool = False,
n_neurons: int = 100,
exc: float = 22.5,
inh: float = 17.5,
dt: float = 1.0,
nu: Optional[Union[float, Sequence[float]]] = (1e-4, 1e-2),
reduction: Optional[callable] = None,
wmin: float = 0.0,
wmax: float = 1.0,
w_dtype: torch.dtype = torch.float32,
norm: float = 78.4,
theta_plus: float = 0.05,
tc_theta_decay: float = 1e7,
inpt_shape: Optional[Iterable[int]] = None,
inh_thresh: float = -40.0,
exc_thresh: float = -52.0,
)
| 99 | """ |
| 100 | |
| 101 | def __init__( |
| 102 | self, |
| 103 | n_inpt: int, |
| 104 | device: str = "cpu", |
| 105 | batch_size: int = None, |
| 106 | sparse: bool = False, |
| 107 | n_neurons: int = 100, |
| 108 | exc: float = 22.5, |
| 109 | inh: float = 17.5, |
| 110 | dt: float = 1.0, |
| 111 | nu: Optional[Union[float, Sequence[float]]] = (1e-4, 1e-2), |
| 112 | reduction: Optional[callable] = None, |
| 113 | wmin: float = 0.0, |
| 114 | wmax: float = 1.0, |
| 115 | w_dtype: torch.dtype = torch.float32, |
| 116 | norm: float = 78.4, |
| 117 | theta_plus: float = 0.05, |
| 118 | tc_theta_decay: float = 1e7, |
| 119 | inpt_shape: Optional[Iterable[int]] = None, |
| 120 | inh_thresh: float = -40.0, |
| 121 | exc_thresh: float = -52.0, |
| 122 | ) -> None: |
| 123 | # language=rst |
| 124 | """ |
| 125 | Constructor for class ``DiehlAndCook2015``. |
| 126 | |
| 127 | :param n_inpt: Number of input neurons. Matches the 1D size of the input data. |
| 128 | :param n_neurons: Number of excitatory, inhibitory neurons. |
| 129 | :param exc: Strength of synapse weights from excitatory to inhibitory layer. |
| 130 | :param inh: Strength of synapse weights from inhibitory to excitatory layer. |
| 131 | :param dt: Simulation time step. |
| 132 | :param nu: Single or pair of learning rates for pre- and post-synaptic events, |
| 133 | respectively. |
| 134 | :param reduction: Method for reducing parameter updates along the minibatch |
| 135 | dimension. |
| 136 | :param wmin: Minimum allowed weight on input to excitatory synapses. |
| 137 | :param wmax: Maximum allowed weight on input to excitatory synapses. |
| 138 | :param w_dtype: Data type for :code:`w` tensor |
| 139 | :param norm: Input to excitatory layer connection weights normalization |
| 140 | constant. |
| 141 | :param theta_plus: On-spike increment of ``DiehlAndCookNodes`` membrane |
| 142 | threshold potential. |
| 143 | :param tc_theta_decay: Time constant of ``DiehlAndCookNodes`` threshold |
| 144 | potential decay. |
| 145 | :param inpt_shape: The dimensionality of the input layer. |
| 146 | """ |
| 147 | super().__init__(dt=dt) |
| 148 | |
| 149 | self.n_inpt = n_inpt |
| 150 | self.inpt_shape = inpt_shape |
| 151 | self.n_neurons = n_neurons |
| 152 | self.exc = exc |
| 153 | self.inh = inh |
| 154 | self.dt = dt |
| 155 | |
| 156 | # Layers |
| 157 | input_layer = Input( |
| 158 | n=self.n_inpt, shape=self.inpt_shape, traces=True, tc_trace=20.0 |
nothing calls this directly
no test coverage detected