|
Kaspersky Neuromorphic Platform
1.0.0
API Reference
|
The Network class is a definition of a neural network that contains populations and projections. More...
#include <knp/framework/network.h>
Collaboration diagram for knp::framework::Network:Public Types | |
| using | AllPopulations = boost::mp11::mp_transform<knp::core::Population, knp::neuron_traits::AllNeurons> |
List of population types based on neuron types specified in knp::neuron_traits::AllNeurons. | |
| using | AllProjections = boost::mp11::mp_transform<knp::core::Projection, knp::synapse_traits::AllSynapses> |
List of projection types based on synapse types specified in knp::synapse_traits::AllSynapses. | |
| using | AllPopulationVariants = boost::mp11::mp_rename<AllPopulations, std::variant> |
Population variant that contains any population type specified in AllPopulations. | |
| using | AllProjectionVariants = boost::mp11::mp_rename<AllProjections, std::variant> |
Projection variant that contains any projection type specified in AllProjections. | |
| using | PopulationContainer = std::vector<core::AllPopulationsVariant> |
| Type of population container. | |
| using | ProjectionContainer = std::vector<core::AllProjectionsVariant> |
| Type of projection container. | |
| using | PopulationIterator = PopulationContainer::iterator |
| Types of population iterators. | |
| using | PopulationConstIterator = PopulationContainer::const_iterator |
| Types of constant population iterators. | |
| using | ProjectionIterator = ProjectionContainer::iterator |
| Types of projection iterators. | |
| using | ProjectionConstIterator = ProjectionContainer::const_iterator |
| Types of constant projection iterators. | |
Public Member Functions | |
| Network ()=default | |
| Default network constructor. | |
| Network (const core::UID &uid) | |
| Network constructor with pre-defined UID. | |
| void | add_population (core::AllPopulationsVariant &&population) |
| Add a population to the network. | |
| template<typename PopulationType > | |
| void | add_population (typename std::decay< PopulationType >::type &&population) |
| Add a population to the network. | |
| template<typename PopulationType > | |
| void | add_population (typename std::decay< PopulationType >::type &population) |
| Add a population to the network. | |
| bool | is_population_exists (const knp::core::UID &population_uid) const |
| Check if population exists. | |
| template<typename NeuronType > | |
| knp::core::Population< NeuronType > & | get_population (const knp::core::UID &population_uid) |
| Get a population with the given UID from the network. | |
| template<typename NeuronType > | |
| const knp::core::Population< NeuronType > & | get_population (const knp::core::UID &population_uid) const |
| Get a population with the given UID from the network. | |
| core::AllPopulationsVariant & | get_population (const knp::core::UID &population_uid) |
| Get a population with the given UID from the network. | |
| void | remove_population (const knp::core::UID &population_uid) |
| Remove a population with the given UID from the network. | |
| void | add_projection (core::AllProjectionsVariant &&projection) |
| Add a projection to the network. | |
| template<typename ProjectionType > | |
| void | add_projection (typename std::decay< ProjectionType >::type &&projection) |
| Add a projection to the network. | |
| template<typename ProjectionType > | |
| void | add_projection (typename std::decay< ProjectionType >::type &projection) |
| Add a projection to the network. | |
| template<typename SynapseType > | |
| void | add_projection (knp::core::UID projection_uid, knp::core::UID pre_population_uid, knp::core::UID post_population_uid, typename knp::core::Projection< SynapseType >::SynapseGenerator generator, size_t synapse_count) |
| Add a projection to the network. | |
| bool | is_projection_exists (const knp::core::UID &projection_uid) const |
| Check if projection exists. | |
| template<typename SynapseType > | |
| knp::core::Projection< SynapseType > & | get_projection (const knp::core::UID &projection_uid) |
| Get a projection with the given UID from the network. | |
| template<typename SynapseType > | |
| const knp::core::Projection< SynapseType > & | get_projection (const knp::core::UID &projection_uid) const |
| Get a projection with the given UID from the network. | |
| core::AllProjectionsVariant & | get_projection (const knp::core::UID &projection_uid) |
| Get a projection with the given UID from the network. | |
| void | remove_projection (const knp::core::UID &projection_uid) |
| Remove a projection with the given UID from the network. | |
| template<typename SynapseType , typename SourceNeuronType , typename DestinationNeuronType > | |
| knp::core::UID | connect_populations (const core::Population< SourceNeuronType > &src, const core::Population< DestinationNeuronType > &dst, typename projection::parameters_generators::SynGen2ParamsType< SynapseType > syn_gen=projection::parameters_generators::default_synapse_gen< SynapseType >) |
| Connect presynaptic and postsynaptic populations and add projection to the network. | |
| template<typename SynapseType , typename SourceNeuronType , typename DestinationNeuronType > | |
| knp::core::UID | connect_populations (const core::Population< SourceNeuronType > &src, const core::Population< DestinationNeuronType > &dst, typename knp::core::Projection< SynapseType >::SynapseGenerator syn_gen, size_t num_iterations) |
| Connect presynaptic and postsynaptic populations and add projection to the network. | |
| PopulationIterator | begin_populations () |
| Get an iterator pointing to the first element of the population. | |
| PopulationConstIterator | begin_populations () const |
| Get an iterator pointing to the first element of the population. | |
| PopulationIterator | end_populations () |
| Get an iterator pointing to the last element of the population. | |
| PopulationConstIterator | end_populations () const |
| Get an iterator pointing to the last element of the population. | |
| ProjectionIterator | begin_projections () |
| Get an iterator pointing to the first element of the projection. | |
| ProjectionConstIterator | begin_projections () const |
| Get an iterator pointing to the first element of the projection. | |
| ProjectionIterator | end_projections () |
| Get an iterator pointing to the last element of the projection. | |
| ProjectionConstIterator | end_projections () const |
| Get an iterator pointing to the last element of the projection. | |
| const PopulationContainer & | get_populations () const |
| Get population container from the network. | |
| const ProjectionContainer & | get_projections () const |
| Get projection container from the network. | |
| size_t | populations_count () const |
| Count populations in the network. | |
| size_t | projections_count () const |
| Count projections in the network. | |
| const knp::core::UID & | get_uid () const |
| Get network UID. | |
| auto & | get_tags () |
| Get tags used by the network. | |
The Network class is a definition of a neural network that contains populations and projections.
| using knp::framework::Network::AllPopulations = boost::mp11::mp_transform<knp::core::Population, knp::neuron_traits::AllNeurons> |
List of population types based on neuron types specified in knp::neuron_traits::AllNeurons.
AllPopulations takes the value of Population<NeuronType_1>, Population<NeuronType_2>, ..., Population<NeuronType_n>, where NeuronType_[1..n] is the neuron type specified in knp::neuron_traits::AllNeurons.
For example, if knp::neuron_traits::AllNeurons contains BLIFATNeuron and IzhikevichNeuron types, then AllPopulations = Population<BLIFATNeuron>, Population<IzhikevichNeuron>.
| using knp::framework::Network::AllPopulationVariants = boost::mp11::mp_rename<AllPopulations, std::variant> |
Population variant that contains any population type specified in AllPopulations.
AllPopulationVariants takes the value of std::variant<PopulationType_1,..., PopulationType_n>, where PopulationType_[1..n] is the population type specified in AllPopulations.
For example, if AllPopulations contains BLIFATNeuron and IzhikevichNeuron types, then AllPopulationVariants = std::variant<BLIFATNeuron, IzhikevichNeuron>.
AllPopulationVariants retains the same order of message types as defined in AllPopulations.
| using knp::framework::Network::AllProjections = boost::mp11::mp_transform<knp::core::Projection, knp::synapse_traits::AllSynapses> |
List of projection types based on synapse types specified in knp::synapse_traits::AllSynapses.
AllProjections takes the value of Projection<SynapseType_1>, Projection<SynapseType_2>, ..., Projection<SynapseType_n>, where SynapseType_[1..n] is the synapse type specified in knp::synapse_traits::AllSynapses.
For example, if knp::synapse_traits::AllSynapses contains DeltaSynapse and AdditiveSTDPSynapse types, then AllProjections = Population<DeltaSynapse>, Population<AdditiveSTDPSynapse>.
| using knp::framework::Network::AllProjectionVariants = boost::mp11::mp_rename<AllProjections, std::variant> |
Projection variant that contains any projection type specified in AllProjections.
AllProjectionVariants takes the value of std::variant<ProjectionType_1,..., ProjectionType_n>, where ProjectionType_[1..n] is the projection type specified in AllProjections.
For example, if AllProjections contains DeltaSynapse and AdditiveSTDPSynapse types, then AllProjectionVariants = std::variant<DeltaSynapse, AdditiveSTDPSynapse>.
AllProjectionVariants retains the same order of message types as defined in AllProjections.
| using knp::framework::Network::PopulationConstIterator = PopulationContainer::const_iterator |
| using knp::framework::Network::PopulationContainer = std::vector<core::AllPopulationsVariant> |
| using knp::framework::Network::PopulationIterator = PopulationContainer::iterator |
| using knp::framework::Network::ProjectionConstIterator = ProjectionContainer::const_iterator |
| using knp::framework::Network::ProjectionContainer = std::vector<core::AllProjectionsVariant> |
| using knp::framework::Network::ProjectionIterator = ProjectionContainer::iterator |
|
inlineexplicit |
| void knp::framework::Network::add_population | ( | core::AllPopulationsVariant && | population | ) |
Add a population to the network.
| population | population to add. |
| void knp::framework::Network::add_population | ( | typename std::decay< PopulationType >::type && | population | ) |
Add a population to the network.
| PopulationType | type of population to add (derived automatically from population if not specified). |
| population | population to add. |
| void knp::framework::Network::add_population | ( | typename std::decay< PopulationType >::type & | population | ) |
Add a population to the network.
| PopulationType | type of population to add (derived automatically from population if not specified). |
| population | population to add. |
| void knp::framework::Network::add_projection | ( | core::AllProjectionsVariant && | projection | ) |
Add a projection to the network.
| projection | projection to add. |
| void knp::framework::Network::add_projection | ( | knp::core::UID | projection_uid, |
| knp::core::UID | pre_population_uid, | ||
| knp::core::UID | post_population_uid, | ||
| typename knp::core::Projection< SynapseType >::SynapseGenerator | generator, | ||
| size_t | synapse_count ) |
Add a projection to the network.
| SynapseType | type of projection synapses. |
| projection_uid | UID of projection to add. |
| generator | synapse generator. |
| pre_population_uid | UID of the presynaptic population. |
| post_population_uid | UID of the postsynaptic population. |
| synapse_count | number of projection synapses. |
| void knp::framework::Network::add_projection | ( | typename std::decay< ProjectionType >::type && | projection | ) |
Add a projection to the network.
| ProjectionType | type of projection to add (derived automatically from projection if not specified). |
| projection | projection to add. |
| void knp::framework::Network::add_projection | ( | typename std::decay< ProjectionType >::type & | projection | ) |
Add a projection to the network.
| ProjectionType | type of projection to add (derived automatically from projection if not specified). |
| projection | projection to add. |
|
nodiscard |
Get an iterator pointing to the first element of the population.
|
nodiscard |
Get an iterator pointing to the first element of the population.
|
nodiscard |
Get an iterator pointing to the first element of the projection.
|
nodiscard |
Get an iterator pointing to the first element of the projection.
|
inline |
Connect presynaptic and postsynaptic populations and add projection to the network.
| SourceNeuronType | type of the presynaptic population neuron. |
| DestinationNeuronType | type of the postsynaptic population neuron. |
| SynapseType | new projection synapse type. |
| src | presynaptic population. |
| dst | postsynaptic population. |
| syn_gen | synapse generator. |
| num_iterations | number of iterations. |
|
inline |
Connect presynaptic and postsynaptic populations and add projection to the network.
The method makes connections between each presynaptic population (source) neuron to each postsynaptic population (destination) neuron.
| SourceNeuronType | type of the presynaptic population neuron. |
| DestinationNeuronType | type of the postsynaptic population neuron. |
| SynapseType | new projection synapse type. |
| src | presynaptic population. |
| dst | postsynaptic population. |
| syn_gen | synapse parameters generator. |
|
nodiscard |
Get an iterator pointing to the last element of the population.
|
nodiscard |
Get an iterator pointing to the last element of the population.
|
nodiscard |
Get an iterator pointing to the last element of the projection.
|
nodiscard |
Get an iterator pointing to the last element of the projection.
|
nodiscard |
Get a population with the given UID from the network.
| NeuronType | type of population neuron. |
| population_uid | population UID. |
| std::logic_error | if population is not found in the network. |
|
nodiscard |
Get a population with the given UID from the network.
| population_uid | population UID. |
| std::logic_error | if population is not found in the network. |
|
nodiscard |
Get a population with the given UID from the network.
| NeuronType | type of population neuron. |
| population_uid | population UID. |
| std::logic_error | if population is not found in the network. |
|
inlinenodiscard |
|
nodiscard |
Get a projection with the given UID from the network.
| SynapseType | type of projection synapse. |
| projection_uid | projection UID. |
| std::logic_error | if projection is not found in the network. |
|
nodiscard |
Get a projection with the given UID from the network.
| projection_uid | projection UID. |
| std::logic_error | if projection is not found in the network. |
|
nodiscard |
Get a projection with the given UID from the network.
| SynapseType | type of projection synapse. |
| projection_uid | projection UID. |
| std::logic_error | if projection is not found in the network. |
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
|
nodiscard |
Check if population exists.
| population_uid | UID of the population to check. |
true if population exists, false otherwise.
|
nodiscard |
Check if projection exists.
| projection_uid | UID of the projection to check. |
true if projection exists, false otherwise.
|
inlinenodiscard |
|
inlinenodiscard |
| void knp::framework::Network::remove_population | ( | const knp::core::UID & | population_uid | ) |
Remove a population with the given UID from the network.
| population_uid | UID of the population to remove. |
| void knp::framework::Network::remove_projection | ( | const knp::core::UID & | projection_uid | ) |
Remove a projection with the given UID from the network.
| projection_uid | UID of the projection to remove. |