Skip to content

Commit 97619e5

Browse files
author
Alexander Ororbia
committed
patched mstdpet unit-test
1 parent c5a13d4 commit 97619e5

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

tests/components/synapses/modulated/test_MSTDPETSynapse.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def test_MSTDPETSynapse1():
2121
# ---- build a simple Poisson cell system ----
2222
with Context(name) as ctx:
2323
a = MSTDPETSynapse(
24-
name="a", shape=(1,1), A_plus=1., A_minus=1., eta=0., key=subkeys[0]
24+
name="a", shape=(1,1), A_plus=1., A_minus=1., eta=0.1, key=subkeys[0]
2525
)
2626

2727
#"""
@@ -49,7 +49,7 @@ def test_MSTDPETSynapse1():
4949
ctx.add_command(wrap_command(jit(ctx.evolve)), name="adapt")
5050
"""
5151

52-
a.weights.set(jnp.ones((1, 1)))
52+
a.weights.set(jnp.ones((1, 1)) * 0.75)
5353

5454
in_spike = jnp.ones((1, 1))
5555
in_trace = jnp.ones((1, 1,)) * 1.25
@@ -58,6 +58,7 @@ def test_MSTDPETSynapse1():
5858
r_neg = -jnp.ones((1, 1))
5959
r_pos = jnp.ones((1, 1))
6060

61+
#print(a.weights.value)
6162
ctx.reset()
6263
a.preSpike.set(in_spike * 0)
6364
a.preTrace.set(in_trace)
@@ -66,8 +67,9 @@ def test_MSTDPETSynapse1():
6667
a.modulator.set(r_pos)
6768
ctx.run(t=1. * dt, dt=dt)
6869
ctx.adapt(t=1. * dt, dt=dt)
69-
#print(a.dWeights.value)
70-
assert_array_equal(a.dWeights.value, jnp.array([[1.25]]))
70+
ctx.adapt(t=1. * dt, dt=dt)
71+
#print(a.weights.value)
72+
assert_array_equal(a.weights.value, jnp.array([[0.875]]))
7173

7274
ctx.reset()
7375
a.preSpike.set(in_spike * 0)
@@ -77,7 +79,8 @@ def test_MSTDPETSynapse1():
7779
a.modulator.set(r_neg)
7880
ctx.run(t=1. * dt, dt=dt)
7981
ctx.adapt(t=1. * dt, dt=dt)
80-
#print(a.dWeights.value)
81-
assert_array_equal(a.dWeights.value, jnp.array([[-1.25]]))
82+
ctx.adapt(t=1. * dt, dt=dt)
83+
#print(a.weights.value)
84+
assert_array_equal(a.weights.value, jnp.array([[0.75]]))
8285

83-
#test_MSTDPETSynapse1()
86+
test_MSTDPETSynapse1()

0 commit comments

Comments
 (0)