|
SNABSuite
0.x
Spiking Neural Architecture Benchmark Suite
|
Classes | |
| struct | CONVOLUTION_LAYER |
| struct | POOLING_LAYER |
Typedefs | |
| typedef std::pair< std::vector< std::vector< Real > >, std::vector< uint16_t > > | MNIST_DATA |
| typedef std::pair< std::vector< std::vector< std::vector< Real > > >, std::vector< uint16_t > > | SPIKING_MNIST |
| typedef std::vector< std::vector< std::vector< std::vector< Real > > > > | CONVOLUTION_FILTER |
| typedef struct CONVOLUTION_LAYER | CONVOLUTION_LAYER |
| typedef struct POOLING_LAYER | POOLING_LAYER |
Enumerations |
Functions | |
| MNIST_DATA | loadMnistData (const size_t num_data, const std::string path) |
| Read in MNIST data from files. More... | |
| void | print_image (const std::vector< Real > &img, size_t wrap) |
| Prints image to std::cout. More... | |
| std::vector< std::vector< std::vector< Real > > > | image_to_rate (const std::vector< std::vector< Real >> &images, const Real duration, const Real max_freq, size_t num_images, bool poisson=true) |
| Converts a vector of images to a rate based representation. More... | |
| SPIKING_MNIST | mnist_to_spike (const MNIST_DATA &mnist_data, const Real duration, const Real max_freq, size_t num_images, bool poisson=true) |
| Converts the full MNIST dataset to a spiking MNIST dataset. More... | |
| std::vector< MNIST_DATA > | create_batches (const SPIKING_MNIST &mnist_data, const size_t batch_size, Real duration, Real pause, const bool shuffle=false, unsigned seed=0) |
| Creates batches of spikes representing the MNIST data. More... | |
| cypress::Population< SpikeSourceArray > | create_spike_source (Network &netw, const MNIST_DATA &spikes) |
| Creates Spike sources in network from spikes. More... | |
| cypress::Population< SpikeSourceArray > & | update_spike_source (cypress::Population< SpikeSourceArray > &source, const MNIST_DATA &spikes) |
| Update Spike sources in network from spikes. More... | |
| Json | read_network (std::string path, bool msgpack=true) |
| Read in the network file from json of msgpack. The Repo provides a script which creates compatible files. More... | |
| template<typename T > | |
| Real | max_weight (const T &json) |
| Calculate the max weight, ignore negative values. More... | |
| template<typename T > | |
| Real | max_weight (const Matrix< T > &mat) |
| Calculate the max weight, ignore negative values. More... | |
| template<typename T > | |
| Real | min_weight (const T &json) |
| Calculate the min weight. More... | |
| template<typename T > | |
| Real | min_weight (const Matrix< T > &json) |
| Calculate the min weight. More... | |
| template<typename T > | |
| Real | max_weight_abs (const T &json) |
| Calculate the max absolute weight. More... | |
| template<typename T > | |
| Real | max_weight_abs (const Matrix< T > &json) |
| Calculate the max absolute weight. More... | |
| std::vector< LocalConnection > | dense_weights_to_conn (const Matrix< Real > &mat, Real scale, Real delay) |
| Convert a dense layer to list of Local Connections. More... | |
| std::vector< LocalConnection > | conv_weights_to_conn (const mnist_helper::CONVOLUTION_LAYER &layer, Real scale, Real delay) |
| Converts a conv layer to list of Local Connections. More... | |
| std::vector< std::vector< LocalConnection > > | pool_to_conn (const mnist_helper::POOLING_LAYER &layer, Real max_pool_weight, Real pool_inhib_weight, Real delay, Real pool_delay) |
| std::vector< uint16_t > | spikes_to_labels (const PopulationBase &pop, Real duration, Real pause, size_t batch_size) |
| Converts the simulation results into label data. More... | |
| void | conv_spikes_per_kernel (const std::string &filename, const PopulationBase &pop, Real duration, Real pause, size_t batch_size, Real norm=0.0) |
| Saves the spikes of a convolution layer in a file. More... | |
| std::vector< std::vector< Real > > | spikes_to_rates (const PopulationBase pop, Real duration, Real pause, size_t batch_size, Real norm=0.0) |
| Converts the simulation results into values between 0 and 1. More... | |
| size_t | compare_labels (std::vector< uint16_t > &label, std::vector< uint16_t > &res) |
| Compare original labels with simulation labels, return number of correct labels. More... | |
| std::vector< Real > | av_pooling_image (std::vector< Real > &image, size_t height, size_t width, size_t pooling_size) |
| Downscale an image by average pooling. More... | |
| MNIST_DATA | scale_mnist (MNIST_DATA &data, size_t pooling_size=3) |
| downscale the complete MNIST dataset More... | |
| SPIKING_MNIST | read_data_to_spike (const size_t num_images, bool train_data, const Real duration, const Real max_freq, bool poisson=true, bool scale_down=false) |
| Reads in MNIST test or train data. More... | |
| std::vector< LocalConnection > | conns_from_mat (const cypress::Matrix< Real > &weights, Real delay, Real scale_factor=0.0) |
| Generate connection from given weight matrix. More... | |
| void | update_conns_from_mat (const std::vector< cypress::Matrix< Real >> &weights, Network &netw, Real delay=1.0, Real scale_factor=0.0) |
| Updates the connector is a given network with the weights provided. More... | |
| struct mnist_helper::CONVOLUTION_LAYER |
Definition at line 38 of file helper_functions.hpp.
| Class Members | ||
|---|---|---|
| CONVOLUTION_FILTER | filter | |
| vector< size_t > | input_sizes | |
| vector< size_t > | output_sizes | |
| size_t | padding | |
| size_t | stride | |
| struct mnist_helper::POOLING_LAYER |
Definition at line 46 of file helper_functions.hpp.
| Class Members | ||
|---|---|---|
| vector< size_t > | input_sizes | |
| vector< size_t > | output_sizes | |
| vector< size_t > | size | |
| size_t | stride | |
| typedef std::vector<std::vector<std::vector<std::vector<Real> > > > mnist_helper::CONVOLUTION_FILTER |
Definition at line 37 of file helper_functions.hpp.
| typedef struct CONVOLUTION_LAYER mnist_helper::CONVOLUTION_LAYER |
Definition at line 45 of file helper_functions.hpp.
| typedef std::pair<std::vector<std::vector<Real> >, std::vector<uint16_t> > mnist_helper::MNIST_DATA |
Definition at line 32 of file helper_functions.hpp.
| typedef struct POOLING_LAYER mnist_helper::POOLING_LAYER |
Definition at line 52 of file helper_functions.hpp.
| typedef std::pair<std::vector<std::vector<std::vector<Real> > >, std::vector<uint16_t> > mnist_helper::SPIKING_MNIST |
Definition at line 35 of file helper_functions.hpp.
| Enumerator | |
|---|---|
| Dense | |
| Conv | |
| Pooling | |
Definition at line 53 of file helper_functions.hpp.
| std::vector<Real> mnist_helper::av_pooling_image | ( | std::vector< Real > & | image, |
| size_t | height, | ||
| size_t | width, | ||
| size_t | pooling_size | ||
| ) |
Downscale an image by average pooling.
| image | the image itself |
| height | height of the image |
| width | width of the image |
| pooling_size | size of the pooling window (e.g. 2) |
| size_t mnist_helper::compare_labels | ( | std::vector< uint16_t > & | label, |
| std::vector< uint16_t > & | res | ||
| ) |
Compare original labels with simulation labels, return number of correct labels.
| label | data label |
| res | label from simulation |
| std::vector<LocalConnection> mnist_helper::conns_from_mat | ( | const cypress::Matrix< Real > & | weights, |
| Real | delay, | ||
| Real | scale_factor = 0.0 |
||
| ) |
Generate connection from given weight matrix.
| weights | the weight matrix, type cypress::Matrix<double> |
| delay | synaptic delay, use 1.0 is unsure |
| scale_factor | scale all weights, do not scale if set to zero |
| void mnist_helper::conv_spikes_per_kernel | ( | const std::string & | filename, |
| const PopulationBase & | pop, | ||
| Real | duration, | ||
| Real | pause, | ||
| size_t | batch_size, | ||
| Real | norm = 0.0 |
||
| ) |
Saves the spikes of a convolution layer in a file.
| filename | the file to save to |
| pop | the neuron population to count spikes from |
| duration | presentation time of a sample |
| pause | pause time in between samples |
| batch_size | number of samples interpreted by these neurons (batch size) |
| norm | divide the number of spikes in bin by this value, ignore if it is set to zero |
| std::vector<LocalConnection> mnist_helper::conv_weights_to_conn | ( | const mnist_helper::CONVOLUTION_LAYER & | layer, |
| Real | scale, | ||
| Real | delay | ||
| ) |
Converts a conv layer to list of Local Connections.
| layer | struct of convolution layer information |
| scale | scale factor for weights |
| delay | synaptic delay |
| std::vector<MNIST_DATA> mnist_helper::create_batches | ( | const SPIKING_MNIST & | mnist_data, |
| const size_t | batch_size, | ||
| Real | duration, | ||
| Real | pause, | ||
| const bool | shuffle = false, |
||
| unsigned | seed = 0 |
||
| ) |
Creates batches of spikes representing the MNIST data.
| mnist_data | Spiking MNIST data |
| batch_size | number of images per batch |
| duration | duration of every image |
| pause | time in between images |
| shuffle | True for shuffling images. Defaults to false. |
| seed | Seed for shuffling images Defaults to 0. |
| cypress::Population<SpikeSourceArray> mnist_helper::create_spike_source | ( | Network & | netw, |
| const MNIST_DATA & | spikes | ||
| ) |
Creates Spike sources in network from spikes.
| netw | a cypress network |
| spikes | One batch from the return value of "create_batch" |
| std::vector<LocalConnection> mnist_helper::dense_weights_to_conn | ( | const Matrix< Real > & | mat, |
| Real | scale, | ||
| Real | delay | ||
| ) |
Convert a dense layer to list of Local Connections.
| mat | cypress matrix of weights |
| scale | scale factor for weights |
| delay | synaptic delay |
| std::vector<std::vector<std::vector<Real> > > mnist_helper::image_to_rate | ( | const std::vector< std::vector< Real >> & | images, |
| const Real | duration, | ||
| const Real | max_freq, | ||
| size_t | num_images, | ||
| bool | poisson = true |
||
| ) |
Converts a vector of images to a rate based representation.
| images | vector of images |
| duration | duration of the rate |
| max_freq | maximal rate/frequency |
| num_images | number of images to read in |
| poisson | False: regular spiking. True: poisson rates. Defaults to true. |
| MNIST_DATA mnist_helper::loadMnistData | ( | const size_t | num_data, |
| const std::string | path | ||
| ) |
Read in MNIST data from files.
| num_data | Number of images |
| path | path to file, without end, e.g. /path/to/data/train for training data, /path/to/data/t10k for test data |
| Real mnist_helper::max_weight | ( | const T & | json | ) |
Calculate the max weight, ignore negative values.
| json | json array containing the weights |
Definition at line 157 of file helper_functions.hpp.
| Real mnist_helper::max_weight | ( | const Matrix< T > & | mat | ) |
Calculate the max weight, ignore negative values.
| mat | cypress Matrix containing the weights |
Definition at line 178 of file helper_functions.hpp.
| Real mnist_helper::max_weight_abs | ( | const T & | json | ) |
Calculate the max absolute weight.
| json | json array containing the weights |
Definition at line 237 of file helper_functions.hpp.
| Real mnist_helper::max_weight_abs | ( | const Matrix< T > & | json | ) |
Calculate the max absolute weight.
| mat | cypress Matrix containing the weights |
Definition at line 258 of file helper_functions.hpp.
| Real mnist_helper::min_weight | ( | const T & | json | ) |
Calculate the min weight.
| json | json array containing the weights |
Definition at line 197 of file helper_functions.hpp.
| Real mnist_helper::min_weight | ( | const Matrix< T > & | json | ) |
Calculate the min weight.
| mat | cypress Matrix containing the weights |
Definition at line 218 of file helper_functions.hpp.
| SPIKING_MNIST mnist_helper::mnist_to_spike | ( | const MNIST_DATA & | mnist_data, |
| const Real | duration, | ||
| const Real | max_freq, | ||
| size_t | num_images, | ||
| bool | poisson = true |
||
| ) |
Converts the full MNIST dataset to a spiking MNIST dataset.
| mnist_data | data container from loadMnistData |
| duration | duration of spikes per image |
| max_freq | Maximal rate (e.g. for px = 1) |
| num_images | number of images to read in |
| poisson | False: regular spiking. True: poisson rates. Defaults to true. |
| std::vector<std::vector<LocalConnection> > mnist_helper::pool_to_conn | ( | const mnist_helper::POOLING_LAYER & | layer, |
| Real | max_pool_weight, | ||
| Real | pool_inhib_weight, | ||
| Real | delay, | ||
| Real | pool_delay | ||
| ) |
| layer | struct of pooling layer information |
| max_pool_weight | scale factor for pooling weights |
| pool_inhib_weight | scale factor for cross inhibitory weights |
| delay | synaptic delay |
| void mnist_helper::print_image | ( | const std::vector< Real > & | img, |
| size_t | wrap | ||
| ) |
Prints image to std::cout.
| img | the image |
| wrap | line wrap -> width of the image |
| SPIKING_MNIST mnist_helper::read_data_to_spike | ( | const size_t | num_images, |
| bool | train_data, | ||
| const Real | duration, | ||
| const Real | max_freq, | ||
| bool | poisson = true, |
||
| bool | scale_down = false |
||
| ) |
Reads in MNIST test or train data.
| num_images | number of images to read in |
| train_data | true for training data, false for test |
| duration | duration of spikes per image |
| max_freq | Maximal rate (e.g. px = 1) |
| poisson | False: regular spiking. True: poisson rates. Defaults to true. |
| scale_down | Scales down the image by a factor of 3 in each dim |
| Json mnist_helper::read_network | ( | std::string | path, |
| bool | msgpack = true |
||
| ) |
Read in the network file from json of msgpack. The Repo provides a script which creates compatible files.
| path | full path to file |
| msgpack | True: Compressed msgpack. False: plain Json. Defaults to true. |
| MNIST_DATA mnist_helper::scale_mnist | ( | MNIST_DATA & | data, |
| size_t | pooling_size = 3 |
||
| ) |
| std::vector<uint16_t> mnist_helper::spikes_to_labels | ( | const PopulationBase & | pop, |
| Real | duration, | ||
| Real | pause, | ||
| size_t | batch_size | ||
| ) |
Converts the simulation results into label data.
| pop | the label population |
| duration | presentation time of a sample |
| pause | pause time in between samples |
| batch_size | number of samples interpreted by these neurons (batch size) |
| std::vector<std::vector<Real> > mnist_helper::spikes_to_rates | ( | const PopulationBase | pop, |
| Real | duration, | ||
| Real | pause, | ||
| size_t | batch_size, | ||
| Real | norm = 0.0 |
||
| ) |
Converts the simulation results into values between 0 and 1.
| pop | the population to be converted to rates |
| duration | presentation time of a sample |
| pause | pause time in between samples |
| batch_size | number of samples interpreted by these neurons (batch size) norm divide the number of spikes in bin by this value, ignore if it is set to zero |
| void mnist_helper::update_conns_from_mat | ( | const std::vector< cypress::Matrix< Real >> & | weights, |
| Network & | netw, | ||
| Real | delay = 1.0, |
||
| Real | scale_factor = 0.0 |
||
| ) |
Updates the connector is a given network with the weights provided.
| weights | the new weight in weights[layer](input, output) |
| netw | the network to alter |
| delay | synaptic delay Defaults to 1.0. |
| scale_factor | Scales the weights during conversion, no scale if set to zero |
| cypress::Population<SpikeSourceArray>& mnist_helper::update_spike_source | ( | cypress::Population< SpikeSourceArray > & | source, |
| const MNIST_DATA & | spikes | ||
| ) |
Update Spike sources in network from spikes.
| source | a cypress source array |
| spikes | One batch from the return value of "create_batch" |
1.8.11