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

Function _drive_shaped

test/network/test_mstdp_florian.py:247–260  ·  view source on GitHub ↗

Drive a conv/local connection with explicitly-shaped spike trains. pre/post: [T, batch, *node_shape]. Returns (weight_change, [eligibility...]).

(conn, pre, post)

Source from the content-addressed store, hash-verified

245
246
247def _drive_shaped(conn, pre, post):
248 """Drive a conv/local connection with explicitly-shaped spike trains.
249
250 pre/post: [T, batch, *node_shape]. Returns (weight_change, [eligibility...]).
251 """
252 T = pre.shape[0]
253 w0 = conn.w.detach().clone()
254 eligs = []
255 for t in range(T):
256 conn.source.s = pre[t].bool()
257 conn.target.s = post[t].bool()
258 conn.update(reward=1.0)
259 eligs.append(conn.update_rule.eligibility.detach().clone())
260 return conn.w.detach() - w0, eligs
261
262
263_LOCAL_CASES = [

Calls 2

cloneMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected