I am getting the following errors on the code below:
import nengo_dl
import nengo
from nengo import solvers
import math
import numpy as np
model = nengo.Network()
case 1:
with model:
inp = nengo.Node(lambda t: np.cos(2 * np.pi * t), label="cosine wave"
A = nengo.Ensemble(30, 1)
nengo.Connection(inp, A)
B = nengo.Ensemble(30, 1)
conn1 = nengo.Connection(A, B,
transform=nengo_dl.dists.Glorot(),
function=math.sin,
learning_rule_type=nengo.BCM(),
label="conn1",
solver=nengo.solvers.Solver(weights=True)
)
with nengo.Simulator(model, dt=1e-3) as sim:
sim.run(1)
conn1_weights_sig = sim.signals[sim.model.sig[conn1]["weights"]]
print("conn1_weights_sig", conn1_weights_sig)
Error: NotImplementedError: Solvers must implement ‘__ call __’
Case 2:
conn1 = nengo.Connection(pre=A.neurons, post=B.neurons,
transform=nengo_dl.dists.Glorot(),
function=math.sin,
learning_rule_type=nengo.BCM(),
label="conn1",
solver=solvers.Solver(weights=True)
)
Error: nengo.exceptions.ValidationError: Connection.function: function ‘’ must accept a single np.array argument
case 3:
conn1 = nengo.Connection(pre=A, post=B,
transform=nengo_dl.dists.Glorot(),
function=math.sin,
learning_rule_type=nengo.BCM(),
label="conn1",
solver=solvers.LstsqL2(weights=True)
)
conn1_weights_sig = sim.signals[sim.model.sig[conn1]["weights"]]
Error: TypeError: ‘NoneType’ object is not subscriptable
I believe it is because I am using function. But, I don’t know why I am getting these errors and even if it runs, why are there no weights (case 3)? With nengo.Simulator is same in all three cases.
Thank you for your time