JesusEV / nest-simulator

The NEST simulator
GNU General Public License v2.0
1 stars 0 forks source link

Fix usage of write_upate_to_history() #12

Closed JesusEV closed 5 months ago

JesusEV commented 5 months ago

Objective of the PR:

This pull request addresses discrepancies in the usage of the function EpropArchivingNode<HistEntryT>::write_update_to_history between the bsshslm_2020 models and other models.

Discrepancy:

  1. bsshslm_2020 Models:

    • These models provide update intervals to write_update_to_history that are relative to the neurons' timelines. To align these times with the origin, an adjustment via the addition of shift is necessary.
  2. Non-bsshslm_2020 Models:

    • These models input spike times directly to write_update_to_history. Since the spike times are already aligned with the origin, adding shift is not only unnecessary but also causes adverse effects. Specifically, it results in the accidental deletion of extra eprop_history_ entries each time erase_used_eprop_history is triggered. This deletion leads to misalignment of the archive entries with respect to the spiking variables used during the compute_gradient function.

This issue went undetected previously due to:

Proposed Solution:

To effectively manage these divergent cases, I propose the following modifications:

  1. Introduce a boolean variable is_bsshslm_2020_model in both register_eprop_connection and write_update_to_history functions. This variable will enable the program to differentiate and appropriately handle the updates based on the model type.

  2. Modify the parameters used to log updates in the history from using t_previous_spike and t_spike directly to using adjusted times t_previous_spike - delay_rec_out and t_spike - delay_rec_out. This change ensures that the intended region of eprop_history (initially [t_previous_spike, t_spike)) is correctly mapped to [t_previous_spike - delay_rec_out, t_spike - delay_rec_out), as depicted in Figure 1.

PR Image

FIGURE 1 remark: The write_learning_signal_to_history function aligns L^t with psi^t in the eprop_archive