(npre, npost, rule, batch=1, nu=1e-2, dt=1.0, **kw)
| 89 | # Helpers to drive a Connection with explicit, controlled spike trains. # |
| 90 | # --------------------------------------------------------------------------- # |
| 91 | def _make_conn(npre, npost, rule, batch=1, nu=1e-2, dt=1.0, **kw): |
| 92 | src = Input(n=npre) |
| 93 | tgt = LIFNodes(n=npost) |
| 94 | src.batch_size = batch |
| 95 | tgt.batch_size = batch |
| 96 | src.s = torch.zeros(batch, npre, dtype=torch.bool) |
| 97 | tgt.s = torch.zeros(batch, npost, dtype=torch.bool) |
| 98 | conn = Connection(src, tgt, nu=nu, update_rule=rule, reduction=torch.sum, **kw) |
| 99 | conn.dt = dt |
| 100 | with torch.no_grad(): |
| 101 | conn.w.zero_() |
| 102 | return conn |
| 103 | |
| 104 | |
| 105 | def _drive(conn, pre, post, rewards): |
no test coverage detected