23#ifndef EPROP_SYNAPSE_BSSHSLM_2020_H
24#define EPROP_SYNAPSE_BSSHSLM_2020_H
237template <
typename target
identifierT >
318 const size_t receptor_type,
374template <
typename target
identifierT >
390template <
typename target
identifierT >
407template <
typename target
identifierT >
414template <
typename target
identifierT >
432template <
typename target
identifierT >
458template <
typename target
identifierT >
473 es.optimizer_ =
nullptr;
477template <
typename target
identifierT >
500 es.optimizer_ =
nullptr;
505template <
typename target
identifierT >
509 size_t receptor_type,
516 throw IllegalConnection(
"eprop synapses currently require a delay of one simulation step" );
528template <
typename target
identifierT >
536template <
typename target
identifierT >
545 const long t_spike = e.get_stamp().get_steps();
546 const bool is_flush_event = e.is_flush_event();
550 if ( is_flush_event )
560 const long shift = target->get_shift();
562 const long interval_step = ( t_spike - shift ) % update_interval;
564 if ( target->is_eprop_recurrent_node() and interval_step == 0 )
576 const long presyn_isi =
579 if ( presyn_isi > 0 )
587 const long idx_current_update = ( t_spike - shift ) / update_interval;
588 const long t_current_update = idx_current_update * update_interval;
598 if ( not is_flush_event )
613 const long idx_current_update = ( t_spike - shift ) / update_interval;
614 const long t_current_update = idx_current_update * update_interval;
616 target->write_update_to_history(
624 if ( not is_flush_event )
628 e.set_receiver( *target );
640template <
typename target
identifierT >
659template <
typename target
identifierT >
677 throw BadProperty(
"Membrane time constant of readout neuron tau_m_readout > 0 required." );
684 if ( weight_ < epcp.optimizer_cp_->get_Wmin() )
686 throw BadProperty(
"Minimal weight Wmin ≤ weight required." );
689 if (
weight_ > epcp.optimizer_cp_->get_Wmax() )
691 throw BadProperty(
"weight ≤ maximal weight Wmax required." );
Dictionary class for interface to Python and C++ API.
Definition dictionary.h:213
Exception to be thrown if a status parameter is incomplete or inconsistent.
Definition exceptions.h:680
CommonSynapseProperties()
Standard constructor.
Definition common_synapse_properties.cpp:36
Base class for dummy nodes used in connection testing.
Definition connection.h:70
double get_delay_ms() const
Definition connection.h:262
void get_status(Dictionary &d) const
size_t get_rport() const
Definition connection.h:316
long get_delay_steps() const
Definition connection.h:271
Connection & operator=(const Connection< targetidentifierT, TotalDelay > &rhs)=default
void set_status(const Dictionary &d, ConnectorModel &cm)
Connection()
Definition connection.h:124
Node * get_target(const size_t tid) const
Definition connection.h:311
void check_connection_(Node &dummy_target, Node &source, Node &target, const synindex syn_id, const size_t receptor_type)
Definition connector_model.h:69
void disable_connection(const size_t lcid) override
Disable the transfer of events through the connection at position lcid.
Definition connector_base.h:563
Connector(const synindex syn_id)
Definition connector_base.h:253
~Connector() override
Definition connector_base.h:259
"Callback request event" for use in Device.
Definition event.h:560
Base class implementing common properties for e-prop synapses.
Definition eprop_synapse_bsshslm_2020.h:177
void get_status(Dictionary &d) const
Get parameter dictionary.
Definition eprop_synapse_bsshslm_2020.cpp:58
~EpropSynapseBSSHSLM2020CommonProperties()
Destructor.
Definition eprop_synapse_bsshslm_2020.cpp:52
WeightOptimizerCommonProperties * optimizer_cp_
Pointer to common properties object for weight optimizer.
Definition eprop_synapse_bsshslm_2020.h:205
EpropSynapseBSSHSLM2020CommonProperties & operator=(const EpropSynapseBSSHSLM2020CommonProperties &)=delete
Assignment operator.
EpropSynapseBSSHSLM2020CommonProperties()
Definition eprop_synapse_bsshslm_2020.cpp:37
void set_status(const Dictionary &d, ConnectorModel &cm)
Update values in parameter dictionary.
Definition eprop_synapse_bsshslm_2020.cpp:68
bool average_gradient_
If True, average the gradient over the learning window.
Definition eprop_synapse_bsshslm_2020.h:198
Encapsulate information sent between nodes.
Definition event.h:103
Definition connector_model.h:156
To be thrown if a connection is not possible.
Definition exceptions.h:490
Base class for all NEST network objects.
Definition node.h:99
virtual void register_eprop_connection()
Registers an eprop connection.
Definition node.cpp:223
virtual void initialize_update_history()
Initializes the update history.
Definition node.cpp:229
Time get_eprop_update_interval() const
Definition simulation_manager.h:343
Event for spike information.
Definition event.h:420
Definition nest_time.h:135
static Time get_resolution()
Definition nest_time.h:325
long get_steps() const
Definition nest_time.h:504
Base class implementing common properties of a weight optimizer model.
Definition weight_optimizer.h:154
virtual WeightOptimizer * get_optimizer() const =0
Get optimizer.
Base class implementing a weight optimizer model.
Definition weight_optimizer.h:238
Dummy node for testing the connection.
Definition eprop_synapse_bsshslm_2020.h:294
size_t handles_test_event(SpikeEvent &, size_t)
Check if the node can handle a particular event and receptor type.
Definition eprop_synapse_bsshslm_2020.h:299
size_t handles_test_event(DSSpikeEvent &, size_t)
Definition eprop_synapse_bsshslm_2020.h:305
Class implementing a synapse model for e-prop plasticity.
Definition eprop_synapse_bsshslm_2020.h:239
size_t get_rport() const
Definition connection.h:316
double weight_
Synaptic weight.
Definition eprop_synapse_bsshslm_2020.h:334
eprop_synapse_bsshslm_2020 & operator=(const eprop_synapse_bsshslm_2020 &)
Assignment operator.
Definition eprop_synapse_bsshslm_2020.h:434
long t_previous_update_
The time step when the previous e-prop update was.
Definition eprop_synapse_bsshslm_2020.h:346
WeightOptimizer * optimizer_
Optimizer.
Definition eprop_synapse_bsshslm_2020.h:371
static constexpr bool supports_flush_event
Whether this connection type supports flush events.
Definition eprop_synapse_bsshslm_2020.h:249
long get_delay_steps() const
Return the delay of the connection in steps.
Definition connection.h:271
~eprop_synapse_bsshslm_2020()
Destructor.
Definition eprop_synapse_bsshslm_2020.h:408
void set_weight(const double w)
Set the synaptic weight to the provided value.
Definition eprop_synapse_bsshslm_2020.h:324
void check_connection(Node &s, Node &t, const size_t receptor_type, const synindex syn_id, const CommonPropertiesType &cp)
Check if the target accepts the event and receptor type requested by the sender.
Definition eprop_synapse_bsshslm_2020.h:507
long t_next_update_
The time step when the next e-prop update will be.
Definition eprop_synapse_bsshslm_2020.h:349
double kappa_
Low-pass filter of the eligibility trace.
Definition eprop_synapse_bsshslm_2020.h:358
Node * get_target(const size_t tid) const
Definition connection.h:311
bool is_recurrent_to_recurrent_conn_
If this connection is between two recurrent neurons.
Definition eprop_synapse_bsshslm_2020.h:361
void delete_optimizer()
Delete optimizer.
Definition eprop_synapse_bsshslm_2020.h:530
long t_spike_previous_
The time step when the previous spike arrived.
Definition eprop_synapse_bsshslm_2020.h:340
void get_status(Dictionary &d) const
Get parameter dictionary.
Definition eprop_synapse_bsshslm_2020.h:642
Connection< targetidentifierT, TotalDelay > ConnectionBase
Type of the connection base.
Definition eprop_synapse_bsshslm_2020.h:246
static constexpr ConnectionModelProperties properties
Properties of the connection model.
Definition eprop_synapse_bsshslm_2020.h:256
EpropSynapseBSSHSLM2020CommonProperties CommonPropertiesType
Type of the common synapse properties.
Definition eprop_synapse_bsshslm_2020.h:243
bool send(Event &e, size_t thread, const EpropSynapseBSSHSLM2020CommonProperties &cp)
Send the spike event.
Definition eprop_synapse_bsshslm_2020.h:538
eprop_synapse_bsshslm_2020()
Default constructor.
Definition eprop_synapse_bsshslm_2020.h:391
double gradient_
Gradient used for the weight update.
Definition eprop_synapse_bsshslm_2020.h:337
std::vector< long > presyn_isis_
Vector of presynaptic inter-spike-intervals.
Definition eprop_synapse_bsshslm_2020.h:364
double tau_m_readout_
Time constant for low-pass filtering the eligibility trace.
Definition eprop_synapse_bsshslm_2020.h:355
bool previous_was_flush_event_
Previous event was a flush event.
Definition eprop_synapse_bsshslm_2020.h:343
void set_status(const Dictionary &d, ConnectorModel &cm)
Update values in parameter dictionary.
Definition eprop_synapse_bsshslm_2020.h:661
long t_previous_trigger_spike_
The time step when the spike arrived that triggered the previous e-prop update.
Definition eprop_synapse_bsshslm_2020.h:352
SimulationManager simulation_manager
Definition kernel_manager.h:237
virtual size_t handles_test_event(SpikeEvent &, size_t receptor_type)
Check if the node can handle a particular event and receptor type.
Definition node.cpp:282
const std::string optimizer("optimizer")
const std::string weight("weight")
const std::string tau_m_readout("tau_m_readout")
const std::string size_of("sizeof")
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33
KernelManager & kernel()
Definition kernel_manager.h:311
ConnectionModelProperties
Definition connector_model.h:49
@ HAS_DELAY
Definition connector_model.h:54
@ REQUIRES_EPROP_ARCHIVING
Definition connector_model.h:59
@ SUPPORTS_HPC
Definition connector_model.h:51
@ IS_PRIMARY
Definition connector_model.h:53
void register_eprop_synapse_bsshslm_2020(const std::string &name)
Register the eprop synapse model.
Definition eprop_synapse_bsshslm_2020.cpp:32
constexpr size_t invalid_port
Value for invalid connection port number.
Definition nest_types.h:147
size_t synindex
For enumerations of synapse types.
Definition nest_types.h:121