From c1f1d11ccf413f6944c58a13d903b942c47b3a79 Mon Sep 17 00:00:00 2001 From: Jan Gosmann Date: Wed, 21 Feb 2018 17:21:28 -0500 Subject: [PATCH] Remove unnecessary argument in Transcode functions. --- nengo_spa/modules/tests/test_transcode.py | 12 ++++++------ nengo_spa/modules/transcode.py | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/nengo_spa/modules/tests/test_transcode.py b/nengo_spa/modules/tests/test_transcode.py index 6270f15ee..0afe06e4c 100644 --- a/nengo_spa/modules/tests/test_transcode.py +++ b/nengo_spa/modules/tests/test_transcode.py @@ -88,8 +88,8 @@ def stimulus(t, x): def test_transcode(Simulator, seed): - def transcode_fn(t, sp, vocab): - assert t < 0.15 or vocab.parse('A').dot(sp) > 0.8 + def transcode_fn(t, sp): + assert t < 0.15 or sp.vocab.parse('A').dot(sp) > 0.8 return 'B' with spa.Network(seed=seed) as model: @@ -123,10 +123,10 @@ class OutputFn(object): def __init__(self): self.called = False - def __call__(self, t, v, vocab): + def __call__(self, t, v): if t > 0.001: self.called = True - assert_almost_equal(vocab.parse('A').v, v.v) + assert_almost_equal(v.vocab.parse('A').v, v.v) output_fn = OutputFn() @@ -142,7 +142,7 @@ def __call__(self, t, v, vocab): def test_decode_with_output(Simulator, seed): - def decode_fn(t, v, vocab): + def decode_fn(t, v): return [t] with spa.Network(seed=seed) as model: @@ -156,7 +156,7 @@ def decode_fn(t, v, vocab): def test_decode_size_out(Simulator, seed): - def decode_fn(t, v, vocab): + def decode_fn(t, v): return [t] with spa.Network(seed=seed) as model: diff --git a/nengo_spa/modules/transcode.py b/nengo_spa/modules/transcode.py index e19a3a56f..0e9774635 100644 --- a/nengo_spa/modules/transcode.py +++ b/nengo_spa/modules/transcode.py @@ -25,7 +25,7 @@ def __call__(self, value): def make_sp_func(fn, vocab): def sp_func(t, v): - return fn(t, SemanticPointer(v), vocab) + return fn(t, SemanticPointer(v, vocab=vocab)) return sp_func @@ -57,8 +57,8 @@ def coerce(self, obj, fn): def coerce_callable(self, obj, fn): t = 0. if obj.input_vocab is not None: - args = (t, SemanticPointer(obj.input_vocab.dimensions), - obj.input_vocab) + args = (t, SemanticPointer( + obj.input_vocab.dimensions, vocab=obj.input_vocab)) elif obj.size_in is not None: args = (t, np.zeros(obj.size_in)) else: