sPyNNaker neural_modelling 7.1.1
Loading...
Searching...
No Matches
Data Structures | Enumerations | Functions | Variables
connection_generator.c File Reference

The implementation of the functions in connection_generator.h. More...

#include "connection_generator.h"
#include <spin1_api.h>
#include <debug.h>
#include "generator_types.h"
#include "connection_generators/connection_generator_one_to_one.h"
#include "connection_generators/connection_generator_all_to_all.h"
#include "connection_generators/connection_generator_fixed_prob.h"
#include "connection_generators/connection_generator_fixed_total.h"
#include "connection_generators/connection_generator_fixed_pre.h"
#include "connection_generators/connection_generator_fixed_post.h"
#include "connection_generators/connection_generator_kernel.h"

Go to the source code of this file.

Data Structures

struct  connection_generator_info
 A "class" for connection generators. More...
 
struct  connection_generator_t
 The data for a connection generator. More...
 

Enumerations

enum  {
  ONE_TO_ONE , ALL_TO_ALL , FIXED_PROBABILITY , FIXED_TOTAL ,
  FIXED_PRE , FIXED_POST , KERNEL , N_CONNECTION_GENERATORS
}
 Known "hashes" of connection generators. More...
 

Functions

connection_generator_t connection_generator_init (uint32_t hash, void **in_region)
 Initialise a specific connection generator.
 
bool connection_generator_generate (connection_generator_t generator, uint32_t pre_lo, uint32_t pre_hi, uint32_t post_lo, uint32_t post_hi, uint32_t post_index, uint32_t post_slice_start, uint32_t post_slice_count, unsigned long accum weight_scale, accum timestep_per_delay, param_generator_t weight_generator, param_generator_t delay_generator, matrix_generator_t matrix_generator)
 Generate connections with a connection generator.
 
void connection_generator_free (connection_generator_t generator)
 Finish with a connection generator.
 

Variables

static const connection_generator_info connection_generators []
 An Array of known generators.
 

Detailed Description

The implementation of the functions in connection_generator.h.

Definition in file connection_generator.c.


Data Structure Documentation

◆ connection_generator_info

struct connection_generator_info

A "class" for connection generators.

Definition at line 50 of file connection_generator.c.

Data Fields
generator_hash_t hash The hash of the generator.
initialize_connector_func * initialize Initialises the generator.
generate_connection_func * generate Generate connections.
free_func * free Frees any data for the generator.

◆ connection_generator

struct connection_generator

The data for a connection generator.

Connection generator "object".

Definition at line 65 of file connection_generator.c.

Data Fields
const connection_generator_info * type
void * data

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Known "hashes" of connection generators.

For now, hash is just an index agreed between Python and here

Enumerator
ONE_TO_ONE 

One-to-one connection generator.

ALL_TO_ALL 

All-to-all connection generator.

FIXED_PROBABILITY 

Fixed probability connection generator.

FIXED_TOTAL 

Fixed total connections connection generator.

FIXED_PRE 

Fixed pre-size connection generator.

FIXED_POST 

Fixed post-size connection generator.

KERNEL 

Convolution kernel connection generator.

N_CONNECTION_GENERATORS 

The number of known generators.

Definition at line 38 of file connection_generator.c.

Function Documentation

◆ connection_generator_init()

connection_generator_t connection_generator_init ( uint32_t  hash,
void **  region 
)

Initialise a specific connection generator.

Parameters
[in]hashThe identifier of the generator to initialise
[in,out]regionThe address to read data from; updated to position after data has been read
Returns
An initialised connection generator that can be used with other functions, or NULL if it couldn't be initialised for any reason

Definition at line 102 of file connection_generator.c.

◆ connection_generator_generate()

bool connection_generator_generate ( connection_generator_t  generator,
uint32_t  pre_lo,
uint32_t  pre_hi,
uint32_t  post_lo,
uint32_t  post_hi,
uint32_t  post_index,
uint32_t  post_slice_start,
uint32_t  post_slice_count,
unsigned long accum  weight_scale,
accum  timestep_per_delay,
param_generator_t  weight_generator,
param_generator_t  delay_generator,
matrix_generator_t  matrix_generator 
)

Generate connections with a connection generator.

Parameters
[in]generatorThe generator to use to generate connections
[in]pre_slice_startThe start of the slice of the pre-population being generated
[in]pre_slice_countThe number of neurons in the slice of the pre-population being generated
[in]pre_neuron_indexThe index of the neuron in the pre-population being generated
[in]post_slice_startThe start of the slice of the post-population being generated
[in]post_slice_countThe number of neurons in the slice of the post-population being generated
[in]max_row_lengthThe maximum number of connections to generate
[in,out]indicesAn array into which the core-relative post-indices should be placed. This will be initialised to be max_row_length in size
Returns
The number of connections generated

Definition at line 130 of file connection_generator.c.

◆ connection_generator_free()

void connection_generator_free ( connection_generator_t  generator)

Finish with a connection generator.

Parameters
[in]generatorThe generator to free

Definition at line 143 of file connection_generator.c.

Variable Documentation

◆ connection_generators

const connection_generator_info connection_generators[]
static
Initial value:
= {
}
@ ALL_TO_ALL
All-to-all connection generator.
@ KERNEL
Convolution kernel connection generator.
@ FIXED_TOTAL
Fixed total connections connection generator.
@ FIXED_PROBABILITY
Fixed probability connection generator.
@ FIXED_POST
Fixed post-size connection generator.
@ FIXED_PRE
Fixed pre-size connection generator.
@ ONE_TO_ONE
One-to-one connection generator.
static void * connection_generator_all_to_all_initialise(void **region)
Initialise the all-to-all connection generator.
static void connection_generator_all_to_all_free(void *generator)
Free the all-to-all connection generator.
static bool connection_generator_all_to_all_generate(void *generator, uint32_t pre_lo, uint32_t pre_hi, uint32_t post_lo, uint32_t post_hi, uint32_t post_index, uint32_t post_slice_start, uint32_t post_slice_count, unsigned long accum weight_scale, accum timestep_per_delay, param_generator_t weight_generator, param_generator_t delay_generator, matrix_generator_t matrix_generator)
Generate connections with the all-to-all connection generator.
static void * connection_generator_fixed_post_initialise(void **region)
Initialise the fixed-post connection generator.
static bool connection_generator_fixed_post_generate(void *generator, uint32_t pre_lo, uint32_t pre_hi, uint32_t post_lo, uint32_t post_hi, uint32_t post_index, uint32_t post_slice_start, uint32_t post_slice_count, unsigned long accum weight_scale, accum timestep_per_delay, param_generator_t weight_generator, param_generator_t delay_generator, matrix_generator_t matrix_generator)
Generate connections with the fixed-post connection generator.
static void connection_generator_fixed_post_free(void *generator)
Free the fixed-post connection generator.
static void * connection_generator_fixed_pre_initialise(void **region)
Initialise the fixed-pre connection generator.
bool connection_generator_fixed_pre_generate(void *generator, uint32_t pre_lo, uint32_t pre_hi, uint32_t post_lo, uint32_t post_hi, uint32_t post_index, uint32_t post_slice_start, uint32_t post_slice_count, unsigned long accum weight_scale, accum timestep_per_delay, param_generator_t weight_generator, param_generator_t delay_generator, matrix_generator_t matrix_generator)
Generate connections with the fixed-pre connection generator.
void connection_generator_fixed_pre_free(void *generator)
Free the fixed-pre connection generator.
static void * connection_generator_fixed_prob_initialise(void **region)
Initialise the fixed-probability connection generator.
static bool connection_generator_fixed_prob_generate(void *generator, uint32_t pre_lo, uint32_t pre_hi, uint32_t post_lo, uint32_t post_hi, uint32_t post_index, uint32_t post_slice_start, uint32_t post_slice_count, unsigned long accum weight_scale, accum timestep_per_delay, param_generator_t weight_generator, param_generator_t delay_generator, matrix_generator_t matrix_generator)
Generate connections with the fixed-probability connection generator.
static void connection_generator_fixed_prob_free(void *generator)
Free the fixed-probability connection generator.
static void connection_generator_fixed_total_free(void *generator)
Free the fixed-total connection generator.
static void * connection_generator_fixed_total_initialise(void **region)
Draw from a binomial distribution i.e. with replacement.
static bool connection_generator_fixed_total_generate(void *generator, uint32_t pre_lo, uint32_t pre_hi, uint32_t post_lo, uint32_t post_hi, uint32_t post_index, uint32_t post_slice_start, uint32_t post_slice_count, unsigned long accum weight_scale, accum timestep_per_delay, param_generator_t weight_generator, param_generator_t delay_generator, matrix_generator_t matrix_generator)
Generate connections with the fixed-total connection generator.
static void connection_generator_kernel_free(void *generator)
Free the convolution-kernel connection generator.
static void * connection_generator_kernel_initialise(void **region)
Initialise the convolution-kernel connection generator.
static bool connection_generator_kernel_generate(void *generator, uint32_t pre_lo, uint32_t pre_hi, uint32_t post_lo, uint32_t post_hi, uint32_t post_index, uint32_t post_slice_start, uint32_t post_slice_count, unsigned long accum weight_scale, accum timestep_per_delay, param_generator_t weight_generator, param_generator_t delay_generator, matrix_generator_t matrix_generator)
Generate connections with the convolution-kernel connection generator.
static bool connection_generator_one_to_one_generate(void *generator, uint32_t pre_lo, uint32_t pre_hi, uint32_t post_lo, uint32_t post_hi, uint32_t post_index, uint32_t post_slice_start, uint32_t post_slice_count, unsigned long accum weight_scale, accum timestep_per_delay, param_generator_t weight_generator, param_generator_t delay_generator, matrix_generator_t matrix_generator)
Generate connections with the one-to-one connection generator.
static void connection_generator_one_to_one_free(void *generator)
Free the one-to-one connection generator.
static void * connection_generator_one_to_one_initialise(void **region)
Initialise the one-to-one connection generator.

An Array of known generators.

Definition at line 71 of file connection_generator.c.