As well as state variables, custom updates can have variable and extra global parameter references which are used to reference variables and extra global parameters belonging to other neuron and synapse groups or even other custom updates.
Variable references
The variable references required by a model called SetTime could be assigned to various types of variable using the following syntax:
SetTime::VarReferences neuronVarReferences(
createVarRef(ng,
"V"));
SetTime::VarReferences currentSourceVarReferences(
createVarRef(cs,
"V"));
SetTime::VarReferences customUpdateVarReferences(
createVarRef(cu,
"V"));
SetTime::VarReferences postsynapticModelVarReferences(
createPSMVarRef(sg,
"V"));
A variable reference called R could be assigned to various types of variable using the following syntax:
neuron_var_ref = {"R": genn_model.create_var_ref(ng, "V")}
current_source_var_ref = {"R": genn_model.create_var_ref(cs, "V")}
custom_update_var_ref = {"R": genn_model.create_var_ref(cu, "V")}
postsynaptic_model_var_ref = {"R": genn_model.create_psm_var_ref(sg, "V")}
wu_pre_var_ref = {"R": genn_model.create_wu_pre_var_ref(sg, "Pre")}
wu_post_var_ref = {"R": genn_model.create_wu_post_var_ref(sg, "Post")}
where ng is a
NeuronGroup pointer (as returned by ModelSpec::addNeuronPopulation)pygenn.NeuronGroup (as returned by pygenn.GeNNModel.add_neuron_population), cs is a
CurrentSource pointer (as returned by ModelSpec::addCurrentSource)pygenn.CurrentSource (as returned by pygenn.GeNNModel.add_current_source), cu is a
CustomUpdate pointer (as returned by ModelSpec::addCustomUpdate)pygenn.genn_groups.CustomUpdate (as returned by pygenn.GeNNModel.add_custom_update) and sg is a
SynapseGroup pointer (as returned by ModelSpec::addSynapsePopulation)pygenn.SynapseGroup (as returned by pygenn.GeNNModel.add_synapse_population).
While references of these types can be used interchangably in the same custom update, as long as all referenced variables have the same delays and belong to populations of the same size, per-synapse weight update model variables must be referenced with slightly different syntax:
where sg is a
SynapseGroup pointer (as returned by ModelSpec::addSynapsePopulation)pygenn.SynapseGroup (as returned by pygenn.GeNNModel.add_synapse_population) and cu is a
CustomUpdate pointer (as returned by ModelSpec::addCustomUpdate)pygenn.genn_groups.CustomUpdate (as returned by pygenn.GeNNModel.add_custom_update) which operates on another synapse group's state variables.
These 'weight update variable references' also have the additional feature that they can be used to define a link to a 'transpose' variable:
SetTime::WUVarReferences wuTransposeVarReferences(
createWUVarRef(sg,
"g", backSG,
"g"));
where
backSG is another SynapseGroup pointerback_sg is another pygenn.SynapseGroup with tranposed dimensions to sg i.e. its
postsynaptic population has the same number of neurons as sg's
presynaptic population and vice-versa.
After the update has run, any updates made to the 'forward' variable will also be applied to the tranpose variable.
- Note
- Tranposing is currently only possible on variables belonging to synapse groups with SynapseMatrixType::DENSE_INDIVIDUALG connectivity.
Extra Global Parameter references
The extra global parameter references required by a model called SetTime could be assigned to various types of extra global parameter using the following syntax:
SetTime::EGPReferences neuronEGPReferences(
createEGPRef(ng,
"E"));
SetTime::EGPReferences currentSourceEGPReferences(
createEGPRef(cs,
"E"));
SetTime::EGPReferences customUpdateEGPReferences(
createEGPRef(cu,
"E"));
SetTime::EGPReferences postsynapticModelEGPReferences(
createPSMEGPRef(sg,
"E"));
SetTime::EGPReferences weightUpdateEGPReferences(
createWUEGPRef(sg,
"E"));
A variable reference called R could be assigned to various types of extra global parameter using the following syntax:
neuron_egp_ref = {"R": genn_model.create_egp_ref(ng, "E")}
current_source_egp_ref = {"R": genn_model.create_egp_ref(cs, "E")}
custom_update_egp_ref = {"R": genn_model.create_egp_ref(cu, "E")}
postsynaptic_model_egp_ref = {"R": genn_model.create_psm_egp_ref(sg, "E")}
weight_update_egp_ref = {"R": genn_model.create_wu_egp_ref(sg, "E")}
where ng is a
NeuronGroup pointer (as returned by ModelSpec::addNeuronPopulation)pygenn.NeuronGroup (as returned by pygenn.GeNNModel.add_neuron_population), cs is a
CurrentSource pointer (as returned by ModelSpec::addCurrentSource)pygenn.CurrentSource (as returned by pygenn.GeNNModel.add_current_source), cu is a
CustomUpdate pointer (as returned by ModelSpec::addCustomUpdate)pygenn.genn_groups.CustomUpdate (as returned by pygenn.GeNNModel.add_custom_update) and sg is a
SynapseGroup pointer (as returned by ModelSpec::addSynapsePopulation)pygenn.SynapseGroup (as returned by pygenn.GeNNModel.add_synapse_population).
Previous | Top | Next