(conn_cls, in_shape, out_shape, rule, batch, tc=20.0)
| 379 | |
| 380 | |
| 381 | def _make_conv(conn_cls, in_shape, out_shape, rule, batch, tc=20.0): |
| 382 | src = Input(shape=in_shape) |
| 383 | tgt = LIFNodes(shape=out_shape) |
| 384 | src.batch_size = batch |
| 385 | tgt.batch_size = batch |
| 386 | src.s = torch.zeros(batch, *in_shape, dtype=torch.bool) |
| 387 | tgt.s = torch.zeros(batch, *out_shape, dtype=torch.bool) |
| 388 | conn = conn_cls( |
| 389 | src, |
| 390 | tgt, |
| 391 | kernel_size=3, |
| 392 | stride=1, |
| 393 | nu=1e-2, |
| 394 | update_rule=rule, |
| 395 | tc_plus=tc, |
| 396 | tc_minus=tc, |
| 397 | ) |
| 398 | conn.dt = 1.0 |
| 399 | with torch.no_grad(): |
| 400 | conn.w.zero_() |
| 401 | return conn |
| 402 | |
| 403 | |
| 404 | class TestConvMSTDP: |
no test coverage detected