GeNN  4.9.0
GPU enhanced Neuronal Networks (GeNN)
pygenn.model_preprocessor Namespace Reference

This module provides functions for model validation, parameter type conversions and defines class Variable. More...

Classes

class  ExtraGlobalParameter
 Class holding information about GeNN extra global paramete. More...
 
class  Variable
 Class holding information about GeNN variables. More...
 

Functions

def prepare_model (model, group, param_space, var_space, model_family)
 Prepare a model by checking its validity and extracting information about variables and parameters. More...
 
def prepare_snippet (snippet, param_space, snippet_family)
 Prepare a snippet by checking its validity and extracting information about parameters. More...
 
def is_model_valid (model, model_family)
 Check whether the model is valid, i.e is native or derived from model_family.Custom. More...
 
def param_space_to_vals (model, param_space)
 Convert a param_space dict to ParamValues. More...
 
def param_space_to_val_vec (model, param_space)
 Convert a param_space dict to a std::vector<double> More...
 
def var_space_to_vals (model, var_space)
 Convert a var_space dict to VarValues. More...
 
def var_ref_space_to_var_refs (model, var_ref_space)
 Convert a var_ref_space dict to VarReferences. More...
 
def var_ref_space_to_wu_var_refs (model, var_ref_space)
 Convert a var_ref_space dict to WUVarReferences. More...
 
def egp_ref_space_to_egp_refs (model, egp_ref_space)
 Convert a egp_ref_space dict to EGPReferences. More...
 
def pre_var_space_to_vals (model, var_space)
 Convert a var_space dict to PreVarValues. More...
 
def post_var_space_to_vals (model, var_space)
 Convert a var_space dict to PostVarValues. More...
 

Detailed Description

This module provides functions for model validation, parameter type conversions and defines class Variable.

Function Documentation

◆ egp_ref_space_to_egp_refs()

def pygenn.model_preprocessor.egp_ref_space_to_egp_refs (   model,
  egp_ref_space 
)

Convert a egp_ref_space dict to EGPReferences.

Parameters
modelinstance of the model
egp_ref_spacedict with extra global parameter references
Returns
native model's EGPReferences

◆ is_model_valid()

def pygenn.model_preprocessor.is_model_valid (   model,
  model_family 
)

Check whether the model is valid, i.e is native or derived from model_family.Custom.

Parameters
modelstring or instance of model_family.Custom
model_familymodel family (NeuronModels, WeightUpdateModels or PostsynapticModels) to which model should belong to
Returns
instance of the model and its type as string

Raises ValueError if model is not valid (i.e. is not custom and is not natively available)

◆ param_space_to_val_vec()

def pygenn.model_preprocessor.param_space_to_val_vec (   model,
  param_space 
)

Convert a param_space dict to a std::vector<double>

Parameters
modelinstance of the model
param_spacedict with parameters
Returns
native vector of parameters

◆ param_space_to_vals()

def pygenn.model_preprocessor.param_space_to_vals (   model,
  param_space 
)

Convert a param_space dict to ParamValues.

Parameters
modelinstance of the model
param_spacedict with parameters
Returns
native model's ParamValues

◆ post_var_space_to_vals()

def pygenn.model_preprocessor.post_var_space_to_vals (   model,
  var_space 
)

Convert a var_space dict to PostVarValues.

Parameters
modelinstance of the weight update model
var_spacedict with Variables
Returns
native model's VarValues

◆ pre_var_space_to_vals()

def pygenn.model_preprocessor.pre_var_space_to_vals (   model,
  var_space 
)

Convert a var_space dict to PreVarValues.

Parameters
modelinstance of the weight update model
var_spacedict with Variables
Returns
native model's VarValues

◆ prepare_model()

def pygenn.model_preprocessor.prepare_model (   model,
  group,
  param_space,
  var_space,
  model_family 
)

Prepare a model by checking its validity and extracting information about variables and parameters.

Parameters
modelstring or instance of a class derived from pygenn.genn_wrapper.NeuronModels.Custom or pygenn.genn_wrapper.WeightUpdateModels.Custom or pygenn.genn_wrapper.CurrentSourceModels.Custom
groupgroup model will belong to
param_spacedict with model parameters
var_spacedict with model variables
var_ref_spaceoptional dict with (custom update) model variable references
model_familypygenn.genn_wrapper.NeuronModels or pygenn.genn_wrapper.WeightUpdateModels or pygenn.genn_wrapper.CurrentSourceModels
Returns
tuple consisting of (model instance, model type, model parameter names, model parameters, list of variable names, dict mapping names of variables to instances of class Variable)

◆ prepare_snippet()

def pygenn.model_preprocessor.prepare_snippet (   snippet,
  param_space,
  snippet_family 
)

Prepare a snippet by checking its validity and extracting information about parameters.

Parameters
snippetstring or instance of a class derived from pygenn.genn_wrapper.InitVarSnippet.Custom,
pygenn.genn_wrapper.InitSparseConnectivitySnippet.Custom or pygenn.genn_wrapper.InitToeplitzConnectivitySnippet.Custom
@param param_space dict with model parameters
@param snippet_family pygenn.genn_wrapper.InitVarSnippet, pygenn.genn_wrapper.InitSparseConnectivitySnippet
or pygenn.genn_wrapper.InitToeplitzConnectivitySnippet
Returns
tuple consisting of (snippet instance, snippet type, snippet parameter names, snippet parameters)

◆ var_ref_space_to_var_refs()

def pygenn.model_preprocessor.var_ref_space_to_var_refs (   model,
  var_ref_space 
)

Convert a var_ref_space dict to VarReferences.

Parameters
modelinstance of the model
var_ref_spacedict with variable references
Returns
native model's VarValues

◆ var_ref_space_to_wu_var_refs()

def pygenn.model_preprocessor.var_ref_space_to_wu_var_refs (   model,
  var_ref_space 
)

Convert a var_ref_space dict to WUVarReferences.

Parameters
modelinstance of the model
var_spacedict with Variables
Returns
native model's VarReferences

◆ var_space_to_vals()

def pygenn.model_preprocessor.var_space_to_vals (   model,
  var_space 
)

Convert a var_space dict to VarValues.

Parameters
modelinstance of the model
var_spacedict with Variables
Returns
native model's VarValues