Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Presynaptic Synapse Variable undefined in Event Threshold Condition #594

Closed
FabianSchubert opened this issue Aug 10, 2023 · 1 comment
Closed
Labels
Milestone

Comments

@FabianSchubert
Copy link
Contributor

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()
@neworderofjamie neworderofjamie added this to the GeNN 5.0.0 milestone Aug 10, 2023
@neworderofjamie
Copy link
Contributor

Pretty sure this is related to the "event threshold retesting" mechanism - it is on my re-implementation hitlist for GeNN 5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants