pynn_brainscales.brainscales2.PlasticityRule

class pynn_brainscales.brainscales2.PlasticityRule(timer: Timer, observables: Optional[Dict[str, Union[ObservablePerSynapse, ObservablePerNeuron, ObservableArray]]] = None, same_id: int = 0)

Bases: pygrenade_vx.network.abstract.frontend.ExperimentElement

Plasticity rule base class. Inheritance is to be used for actual implementations. Periodic timing information is provided via class Timer. The kernel implementation is required to be in the form of C++-based PPU kernel code.

__init__(timer: Timer, observables: Optional[Dict[str, Union[ObservablePerSynapse, ObservablePerNeuron, ObservableArray]]] = None, same_id: int = 0)

Create a new plasticity rule with timing information.

Parameters
  • timer – Timer object.

  • same_id – Identifier of same plasticity rule. Plasticity rules with equal identifier share their state across realtime snippets. Currently, in addition, the complete provided kernel code is required to be equal.

Methods

__init__(timer[, observables, same_id])

Create a new plasticity rule with timing information.

add_to_input_data(experiment, …)

Add element to experiment snippet’s input data.

add_to_topology(experiment)

Add element to experiment snippet’s topology.

extract_output_data(experiment)

Extract output data of element from experiment snippet.

generate_dynamics(snippet_begin_time, …)

generate_kernel()

Generate plasticity rule kernel to be compiled into PPU program.

generate_parameterization()

generate_vertex()

get_observable_array(observable)

Get data for an array observable.

Attributes

observables

same_id

timer

class ObservableArray

Bases: pybind11_builtins.pybind11_object

class Type

Bases: pybind11_builtins.pybind11_object

class Int16

Bases: pybind11_builtins.pybind11_object

class Int8

Bases: pybind11_builtins.pybind11_object

class UInt16

Bases: pybind11_builtins.pybind11_object

class UInt8

Bases: pybind11_builtins.pybind11_object

int16 = int16
int8 = int8
uint16 = uint16
uint8 = uint8
property size
property type
class ObservablePerNeuron

Bases: pybind11_builtins.pybind11_object

class Layout

Bases: pybind11_builtins.pybind11_object

Members:

complete_row

packed_active_columns

complete_row = <Layout.complete_row: 0>
property name
packed_active_columns = <Layout.packed_active_columns: 1>
property value
class Type

Bases: pybind11_builtins.pybind11_object

class Int16

Bases: pybind11_builtins.pybind11_object

class Int8

Bases: pybind11_builtins.pybind11_object

class UInt16

Bases: pybind11_builtins.pybind11_object

class UInt8

Bases: pybind11_builtins.pybind11_object

int16 = int16
int8 = int8
uint16 = uint16
uint8 = uint8
property layout
property type
class ObservablePerSynapse

Bases: pybind11_builtins.pybind11_object

class LayoutPerRow

Bases: pybind11_builtins.pybind11_object

Members:

complete_rows

packed_active_columns

complete_rows = <LayoutPerRow.complete_rows: 0>
property name
packed_active_columns = <LayoutPerRow.packed_active_columns: 1>
property value
class Type

Bases: pybind11_builtins.pybind11_object

class Int16

Bases: pybind11_builtins.pybind11_object

class Int8

Bases: pybind11_builtins.pybind11_object

class UInt16

Bases: pybind11_builtins.pybind11_object

class UInt8

Bases: pybind11_builtins.pybind11_object

int16 = int16
int8 = int8
uint16 = uint16
uint8 = uint8
property layout_per_row
property type
add_to_input_data(experiment: pygrenade_vx.network.abstract.frontend.ExperimentSnippet, snippet_begin_time, snippet_end_time)

Add element to experiment snippet’s input data.

If the snippet doesn’t contain the element yet, it is added. If it is already contained it is updated, if changed_input_data is True. The method is called after mapping is available.

Parameters
  • experiment – Experiment snippet for which to add this element into the snippet’s input data

  • snippet_begin_time – Time at which the snippet begins

  • snippet_end_time – Time at which the snippet ends

add_to_topology(experiment: pygrenade_vx.network.abstract.frontend.ExperimentSnippet)

Add element to experiment snippet’s topology.

If the snippet doesn’t contain the element yet, it is added. If it is already contained it is updated, if changed_topology is True. This method is called before the potential mapping operation.

Parameters

experiment – Experiment snippet for which to add this element into the snippet’s topology

Returns

Whether the element was added to the topology. The experiment doesn’t track interdependencies defining the order in which the elements can be added to the topology. Therefore this method is expected to perform the check whether the element can be added or updated, in which case the return value is expected to be True.

extract_output_data(experiment: List[pygrenade_vx.network.abstract.frontend.ExperimentSnippet])

Extract output data of element from experiment snippet. This method is called after execution of the experiment. Storage in the front end format is to be performed by the front end.

Parameters

experiment – Experiment snippet from which to extract this element’s output data

generate_dynamics(snippet_begin_time, snippet_end_time)_pygrenade_vx_network_abstract.PlasticityRule.Dynamics
generate_kernel()str

Generate plasticity rule kernel to be compiled into PPU program. The interface to be adhered to is the same as in the empty implementation below. PLASTICITY_RULE_KERNEL is the generic name of the kernel function, which will be expanded to a unique implementation-defined name upon compilation to allow for multiple kernels.

Returns

PPU-code of plasticity-rule kernel as string.

generate_parameterization()_pygrenade_vx_network_abstract.PlasticityRule.Parameterization
generate_vertex()_pygrenade_vx_network_abstract.PlasticityRule
get_observable_array(observable: str)object

Get data for an array observable.

Parameters

observable – Name of observable.

Returns

Array with recorded data. The array’s entries are values for each timer entry. Each value has a .data attribute, containing the recorded data. This data is twice the size set when initializing the observable, since it is added for both top and bottom PPUs.

Raises
  • RuntimeError – If observable name is not known.

  • TypeError – If observable is not an ObservableArray.

property observables
property same_id
property timer