Beispiel #1
0
def test_pointer_symbol_network_creation(rng):
    vocab = spa.Vocabulary(16, pointer_gen=rng)
    vocab.populate("A")

    with spa.Network():
        A = PointerSymbol("A", TVocabulary(vocab))
        node = A.construct()
    assert_equal(node.output, vocab["A"].v)
Beispiel #2
0
def test_transformed(Simulator, algebra, rng):
    vocab = spa.Vocabulary(16, pointer_gen=rng, algebra=algebra)
    vocab.populate("A; B")

    with spa.Network() as model:
        a = spa.Transcode("A", output_vocab=vocab)
        x = PointerSymbol("B") * a
        p = nengo.Probe(x.construct(), synapse=0.3)

    with nengo.Simulator(model) as sim:
        sim.run(0.3)

    assert_sp_close(sim.trange(),
                    sim.data[p],
                    vocab.parse("B*A"),
                    skip=0.2,
                    normalized=True)