Open brendanjohnharris opened 1 month ago
Thank you for your question!
A contributor proposed a solution in a pull request (https://github.com/brainpy/BrainPy/pull/595) to address non-uniform transmission delays. Although this PR hasn't been merged, it provides a useful approach:
This PR introduces a new class called
HeteroLengthDelay
in the filebrainpy/_src/math/delayvars.py
. It is a modification of theLengthDelay
class with the following changes:
- The
__init__()
function requires the delay length of each synapse and the number of synapses per pre-synaptic neuron. The delay length array should be sorted by pre-synaptic neuron index.- The
retrieve()
function outputs a 1D array of spikes delivered to each synapse, with the length of the array corresponding to the number of synapses, not post-synaptic neurons.- Imports for
numpy
andbrainpy.math
have been added.The class internally stores previous spikes in a matrix of dimensions
[max_delay_length, num_pre_neurons]
, and it should work as long as memory limits are respected.
However, we do not recommend using this method for GPU implementations because pure heterogeneous delay retrieval is very expensive. Instead, we suggest using the Taichi custom interface(in brainpy.math.XLACustomOp
) to merge delay retrieval and sparse computations, minimizing the memory indexing overhead.
Hope this helps! Feel free to reach out if you have further questions.
Hi Brendan! Here are some additional remarks.
Unfortunately, BrainPy currently does not have a straightforward way to implement non-uniform delays in the network. AlignPre
and AlignPost
have an assumption that all synapses in one projection share the same delay. So using non-uniform delays in our synaptic projection classes is not easy.
However, there is one alternative (relatively simple but ugly) way to do this. If we separate our neuron groups into several subgroups, the synaptic projections will be defined between each subgroup and each projection can define one delay that differs from the others. I don't know if this approach sounds good to you.
Hi brainpy!
I am hoping to incorporate non-uniform transmission delays into a LIF network (i.e. each synapse has a different delay), but I can't find a straightfoward way to implement this from the documentation. For instance, in the example below I have tried passing an initializer for the delay to the synaptic projection classes with reduction and merging, which fails (as expected). Is there a recommended way of constructing non-uniform delays, by drawing delays for each synapse from the initializer?