Implements the spiking neural network architecture from `(Diehl & Cook 2015) `_.
| 92 | |
| 93 | |
| 94 | class DiehlAndCook2015(Network): |
| 95 | # language=rst |
| 96 | """ |
| 97 | Implements the spiking neural network architecture from `(Diehl & Cook 2015) |
| 98 | <https://www.frontiersin.org/articles/10.3389/fncom.2015.00099/full>`_. |
| 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 |
no outgoing calls