GeNN
4.9.0
GPU enhanced Neuronal Networks (GeNN)
|
Neuron, weight update, postsynaptic and custom update models all have state variables which GeNN can automatically initialise.
Previously we have shown variables being initialised to constant values such as:
or initialised using one of a number of predefined variable initialisation snippets:For example, to initialise a parameter using values drawn from the normal distribution:
Similarly to neuron, weight update and postsynaptic models, new variable initialisation snippets can be created by simply defining a class in the model description. For example, when initialising excitatory (positive) synaptic weights with a normal distribution they should be clipped at 0 so the long tail of the normal distribution doesn't result in negative weights. This could be implemented using the following variable initialisation snippet which redraws until samples are within the desired bounds:
Within the snippet of code specified using the , when initialisising neuron and postaynaptic model state variables , the $(id) variable can be used to access the id of the neuron being initialised. Similarly, when initialising weight update model state variables, the $(id_pre) and $(id_post) variables can used to access the ids of the pre and postsynaptic neurons connected by the synapse being initialised.Once you have defined how your variables are going to be initialised you need to configure where they will be allocated. By default memory is allocated for variables on both the GPU and the host. However, the following alternative 'variable locations' are available:
These modes can be set as a model default using ModelSpec::setDefaultVarLocation
or on a per-variable basis using one of the following functions: