Beispiel #1
0
def test_activate_direct_mode_learning(RefSimulator, learning_rule, weights):
    with nengo.Network() as model:
        pre = nengo.Ensemble(10, 1)
        post = nengo.Ensemble(10, 1)
        conn = nengo.Connection(pre,
                                post,
                                solver=nengo.solvers.LstsqL2(weights=weights))
        conn.learning_rule_type = learning_rule

    activate_direct_mode(model)

    with RefSimulator(model) as sim:
        sim.run(0.01)
Beispiel #2
0
def test_activate_direct_mode():
    with nengo.Network() as model:
        direct_mode_ens = [nengo.Ensemble(10, 1), nengo.Ensemble(10, 1)]
        non_direct_pre = nengo.Ensemble(10, 1)
        non_direct_post = nengo.Ensemble(10, 1)
        non_direct_probe = nengo.Ensemble(10, 1)
        non_direct_mode_ens = [
            non_direct_pre, non_direct_post, non_direct_probe
        ]

        nengo.Connection(direct_mode_ens[0], direct_mode_ens[1])

        nengo.Connection(non_direct_pre.neurons[0], direct_mode_ens[0])
        nengo.Connection(direct_mode_ens[1], non_direct_post.neurons[0])
        nengo.Probe(non_direct_probe.neurons)

    activate_direct_mode(model)

    for ens in direct_mode_ens:
        assert type(ens.neuron_type) is nengo.Direct
    for ens in non_direct_mode_ens:
        assert type(ens.neuron_type) is not nengo.Direct