(self)
| 161 | ) |
| 162 | |
| 163 | def test_mstdp(self): |
| 164 | # Connection test |
| 165 | network = Network(dt=1.0) |
| 166 | network.add_layer(Input(n=100), name="input") |
| 167 | network.add_layer(LIFNodes(n=100), name="output") |
| 168 | network.add_connection( |
| 169 | Connection( |
| 170 | source=network.layers["input"], |
| 171 | target=network.layers["output"], |
| 172 | nu=1e-2, |
| 173 | update_rule=MSTDP, |
| 174 | ), |
| 175 | source="input", |
| 176 | target="output", |
| 177 | ) |
| 178 | network.run( |
| 179 | inputs={"input": torch.bernoulli(torch.rand(250, 100)).byte()}, |
| 180 | time=250, |
| 181 | reward=1.0, |
| 182 | ) |
| 183 | |
| 184 | # Conv2dConnection test |
| 185 | network = Network(dt=1.0) |
| 186 | network.add_layer(Input(shape=[1, 10, 10]), name="input") |
| 187 | network.add_layer(LIFNodes(shape=[32, 8, 8]), name="output") |
| 188 | network.add_connection( |
| 189 | Conv2dConnection( |
| 190 | source=network.layers["input"], |
| 191 | target=network.layers["output"], |
| 192 | kernel_size=3, |
| 193 | stride=1, |
| 194 | nu=1e-2, |
| 195 | update_rule=MSTDP, |
| 196 | ), |
| 197 | source="input", |
| 198 | target="output", |
| 199 | ) |
| 200 | |
| 201 | network.run( |
| 202 | inputs={"input": torch.bernoulli(torch.rand(250, 1, 1, 10, 10)).byte()}, |
| 203 | time=250, |
| 204 | reward=1.0, |
| 205 | ) |
| 206 | |
| 207 | def test_mstdpet(self): |
| 208 | # Connection test |
nothing calls this directly
no test coverage detected