AlignPostProj#
- class brainpy.state.AlignPostProj(*modules, comm, syn, out, post, label=None)#
Post-synaptic alignment projection.
In this projection pattern, the synapse dynamics and synaptic output are aligned with (owned by) the post-synaptic neuron. Multiple projections targeting the same post-synaptic population with the same synapse/output descriptor share a single synapse and output instance, enabling efficient event-driven updates.
The update pipeline is:
Optional pre-processing modules transform the input.
The communication module (
comm) maps pre-synaptic signals to post-synaptic space.The result is added as a delta input to the shared synapse.
The synapse and output are updated by the post-synaptic neuron’s
before_updatehook (if using descriptor merging).
- Parameters:
*modules – Optional pre-processing modules applied sequentially to the input before the communication step.
comm (
Callable) – Communication module (e.g.,brainevent.nn.FixedProb) that maps pre-synaptic activity to post-synaptic space.syn (
ParamDescriber[AlignPost]orAlignPost) – Synapse model or its descriptor. When a descriptor is provided, the synapse is created lazily and shared across projections targeting the same post-synaptic neuron.out (
ParamDescriber[SynOut]orSynOut) – Synaptic output module or its descriptor.post (
Dynamics) – Post-synaptic neural population.label (
str, optional) – Label for identifying this projection’s contribution in the post-synaptic neuron’s input dictionary.
- Raises:
TypeError – If
commis not callable, ifsyn/outtypes are inconsistent, or ifpostis not aDynamicsinstance.
See also
DeltaProjDirect delta-input projection.
CurrentProjCurrent-based projection.
align_post_projectionConvenience wrapper with spike generation.
Notes
When both
synandoutare descriptors (ParamDescriber), the projection attempts to merge with existing synapse/output instances on the post-synaptic neuron, avoiding duplicate state.When
synis an already-instantiatedAlignPostobject, no merging occurs andoutmust also be an instantiatedSynOut.
References
Examples
>>> import brainpy >>> import brainstate >>> import saiunit as u >>> n_pre, n_post = 800, 200 >>> post_pop = brainpy.state.LIF(n_post, tau=20.*u.ms) >>> post_pop.init_state() >>> proj = brainpy.state.AlignPostProj( ... comm=brainstate.nn.Linear(n_pre, n_post), ... syn=brainpy.state.Expon.desc(n_post, tau=5.*u.ms), ... out=brainpy.state.CUBA.desc(scale=u.volt), ... post=post_pop, ... )