MCPcopy Create free account
hub / github.com/BindsNET/bindsnet / _make_conn

Function _make_conn

test/network/test_mstdp_florian.py:91–102  ·  view source on GitHub ↗
(npre, npost, rule, batch=1, nu=1e-2, dt=1.0, **kw)

Source from the content-addressed store, hash-verified

89# Helpers to drive a Connection with explicit, controlled spike trains. #
90# --------------------------------------------------------------------------- #
91def _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
105def _drive(conn, pre, post, rewards):

Calls 3

InputClass · 0.90
LIFNodesClass · 0.90
ConnectionClass · 0.90

Tested by

no test coverage detected