Skip to content

Presynaptic Synapse Variable undefined in Event Threshold Condition #594

@FabianSchubert

Description

@FabianSchubert

Situation:

  • A population has two or more outgoing synapse groups using the same weight update model.
  • The weight update model has a presynaptic variable that is used in the event code.

Error:
RuntimeError: The variable <presyn. variable name> was undefined in code eventThresholdConditionCode.
This does not happen for a single synapse population.

Minimal example:

from pygenn.genn_model import (GeNNModel, create_custom_neuron_class,
        create_custom_weight_update_class, create_custom_postsynaptic_class)

neuron_model = create_custom_neuron_class(
        "test_neuron",
        param_names=[],
        var_name_types=[("r", "scalar")],
        sim_code=""
)

wu_model = create_custom_weight_update_class(
    "test_wu_model",
    param_names=["th"],
    var_name_types=[("g", "scalar")],
    pre_var_name_types=[("presyn_var", "scalar")],
    event_code="""
        $(presyn_var) = $(r_pre);
    """,
    synapse_dynamics_code="$(addToInSyn, $(g) * $(presyn_var));",
    event_threshold_condition_code="abs($(r_pre) - $(presyn_var)) >= $(th)"
)

model = GeNNModel("float", "testmodel")

p1 = model.add_neuron_population("p1", 1, neuron_model, param_space={}, var_space={"r": 1.0})
p2 = model.add_neuron_population("p2", 1, neuron_model, param_space={}, var_space={"r": 1.0})
p3 = model.add_neuron_population("p3", 1, neuron_model, param_space={}, var_space={"r": 1.0})

syn12 = model.add_synapse_population(
    "syn12", "DENSE_INDIVIDUALG", 0,
    p1, p2, wu_model, {"th": 1e-3}, {"g": 1.0},
    {"presyn_var": 0.0}, {},
    "DeltaCurr", {}, {}
)

syn13 = model.add_synapse_population(
    "syn13", "DENSE_INDIVIDUALG", 0,
    p1, p3, wu_model, {"th": 1e-3}, {"g": 1.0},
    {"presyn_var": 0.0}, {},
    "DeltaCurr", {}, {}
)

model.build()
model.load()

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions