23#ifndef EPROP_SYNAPSE_H
24#define EPROP_SYNAPSE_H
220template <
typename target
identifierT >
301 const size_t receptor_type,
360template <
typename target
identifierT >
376template <
typename target
identifierT >
387template <
typename target
identifierT >
394template <
typename target
identifierT >
403template <
typename target
identifierT >
431template <
typename target
identifierT >
449 es.optimizer_ =
nullptr;
453template <
typename target
identifierT >
479 es.optimizer_ =
nullptr;
484template <
typename target
identifierT >
488 size_t receptor_type,
495 throw IllegalConnection(
"eprop synapses currently require a delay of one simulation step" );
506template <
typename target
identifierT >
514template <
typename target
identifierT >
521 const long t_spike = e.get_stamp().get_steps();
522 const bool is_flush_event = e.is_flush_event();
526 target->compute_gradient( t_spike,
548 if ( not is_flush_event )
550 e.set_receiver( *target );
559template <
typename target
identifierT >
577template <
typename target
identifierT >
596 if ( weight_ < epcp.optimizer_cp_->get_Wmin() )
598 throw BadProperty(
"Minimal weight Wmin ≤ weight required." );
601 if (
weight_ > epcp.optimizer_cp_->get_Wmax() )
603 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 with additional biological features.
Definition eprop_synapse.h:165
WeightOptimizerCommonProperties * optimizer_cp_
Pointer to common properties object for weight optimizer.
Definition eprop_synapse.h:190
~EpropSynapseCommonProperties()
Destructor.
Definition eprop_synapse.cpp:49
EpropSynapseCommonProperties & operator=(const EpropSynapseCommonProperties &)=delete
Assignment operator.
EpropSynapseCommonProperties()
Definition eprop_synapse.cpp:37
void get_status(Dictionary &d) const
Get parameter dictionary.
Definition eprop_synapse.cpp:55
void set_status(const Dictionary &d, ConnectorModel &cm)
Update values in parameter dictionary.
Definition eprop_synapse.cpp:65
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
Event for spike information.
Definition event.h:420
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.h:277
size_t handles_test_event(SpikeEvent &, size_t)
Check if the node can handle a particular event and receptor type.
Definition eprop_synapse.h:282
size_t handles_test_event(DSSpikeEvent &, size_t)
Definition eprop_synapse.h:288
Class implementing a synapse model for e-prop plasticity with additional biological features.
Definition eprop_synapse.h:222
size_t get_rport() const
Definition connection.h:316
double z_bar_
Low-pass filtered spiking variable.
Definition eprop_synapse.h:329
double weight_
Synaptic weight.
Definition eprop_synapse.h:317
static constexpr bool supports_flush_event
Whether this connection type supports flush events.
Definition eprop_synapse.h:241
EpropSynapseCommonProperties CommonPropertiesType
Type of the common synapse properties.
Definition eprop_synapse.h:226
double epsilon_
Adaptive threshold component of the eligibility vector.
Definition eprop_synapse.h:338
double gradient_
Sum of gradients.
Definition eprop_synapse.h:344
eprop_synapse & operator=(const eprop_synapse &)
Assignment operator.
Definition eprop_synapse.h:405
long remaining_steps_until_cutoff_
Remaining computation steps.
Definition eprop_synapse.h:347
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.h:486
long t_previous_trigger_spike_
The time step when the spike arrived that triggered the previous e-prop update.
Definition eprop_synapse.h:326
void set_status(const Dictionary &d, ConnectorModel &cm)
Update values in parameter dictionary.
Definition eprop_synapse.h:579
long get_delay_steps() const
Return the delay of the connection in steps.
Definition connection.h:271
void set_weight(const double w)
Set the synaptic weight to the provided value.
Definition eprop_synapse.h:307
~eprop_synapse()
Destructor.
Definition eprop_synapse.h:388
Node * get_target(const size_t tid) const
Definition connection.h:311
bool previous_was_flush_event_
Previous event was a flush event.
Definition eprop_synapse.h:323
double z_previous_buffer_
Value of spiking variable one time step before t_previous_spike_.
Definition eprop_synapse.h:341
eprop_synapse()
Default constructor.
Definition eprop_synapse.h:377
WeightOptimizer * optimizer_
Optimizer.
Definition eprop_synapse.h:357
Connection< targetidentifierT, TotalDelay > ConnectionBase
Type of the connection base.
Definition eprop_synapse.h:229
void get_status(Dictionary &d) const
Get parameter dictionary.
Definition eprop_synapse.h:561
double e_bar_reg_
Low-pass filtered eligibility trace for firing rate regularization.
Definition eprop_synapse.h:335
void delete_optimizer()
Delete optimizer.
Definition eprop_synapse.h:508
static constexpr ConnectionModelProperties properties
Properties of the connection model.
Definition eprop_synapse.h:236
long decay_steps_
Decay steps for the eligibility trace.
Definition eprop_synapse.h:350
long t_spike_previous_
The time step when the previous spike arrived.
Definition eprop_synapse.h:320
double e_bar_
Low-pass filtered eligibility trace.
Definition eprop_synapse.h:332
bool send(Event &e, size_t thread, const EpropSynapseCommonProperties &cp)
Send the spike event.
Definition eprop_synapse.h:516
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 size_of("sizeof")
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33
void register_eprop_synapse(const std::string &name)
Register the eprop synapse model.
Definition eprop_synapse.cpp:32
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
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