calix.hagen.synapse_driver.SynapseDriverMeasurement
-
class
calix.hagen.synapse_driver.
SynapseDriverMeasurement
(n_parallel_measurements: int = 1) Bases:
object
Provides a function to measure output amplitudes of each synapse driver.
Each synapse driver is connected to at least 8 synapse columns, their median result is taken as the driver’s output amplitude. The requested number of parallel measurements determines how many synapse columns are used per driver: If only one driver is measured at a time, all 256 synapse columns are used.
When several synapse drivers are measured in parallel, events are sent to one synapse driver after another. Due to analog effects in the synapse array, earlier events will result in a lower activation than later events. Do not use more than one parallel measurement if you cannot cope with this effect.
- Variables
n_parallel_measurements – Number of synapse drivers to be measured in one run. Only powers of 2 are supported, i.e. possible values are 1, 2, 4, 8, 16, 32. We do not support more than 32 parallel measurements since we require at least 8 synapse columns per driver, in order to take the median read from those as the driver’s output.
multiplication – Multiplication class used for measurements. Each measurement run is a vector-matrix multiplication.
-
__init__
(n_parallel_measurements: int = 1) Initialize self. See help(type(self)) for accurate signature.
Methods
__init__
([n_parallel_measurements])Initialize self.
get_input_vectors
(activations)Create vectors that are multiplied with the synapse matrix in order to characterize all drivers’ outputs at the given activations.
get_synapse_mapping
(driver)Return mask of synapses to enable in a row.
get_synapse_matrix
([weight])Return a mapping matrix using the given weight.
measure_syndrv_amplitudes
(connection, …[, …])Multiply the given activation with a suitable weight matrix to determine the output amplitudes of each driver.
-
get_input_vectors
(activations: numpy.ndarray) → numpy.ndarray Create vectors that are multiplied with the synapse matrix in order to characterize all drivers’ outputs at the given activations.
In each vector, we send activations to a subset of drivers, that has different columns for their results. Hence, the unique activations of each driver can be obtained. Only in the next vector, we reuse the same columns in order to characterize each synapse driver.
- Parameters
activations – Array of activations, each is tested.
- Returns
Array of vectors, to be used as input for multiplication.
-
get_synapse_mapping
(driver: pyhalco_hicann_dls_vx_v3.SynapseDriverOnSynapseDriverBlock) → numpy.ndarray Return mask of synapses to enable in a row.
This function can be called for all synapse drivers and will return a synapse matrix that allows measuring amplitudes from a block of self.n_parallel_measurements drivers in parallel. The synapse matrix is configured such that the drivers which are measured in parallel do not use the same synapse columns. For the next block of synapse drivers which are measured in parallel, the same synapse columns as for the previous block can be used.
- Parameters
driver – Coordinate of the synapse driver which shall be connected to neurons.
- Returns
Boolean mask of enabled synapses within the synapse driver’s row.
-
get_synapse_matrix
(weight: pyhaldls_vx_v3.SynapseWeightQuad.Value = 63) → numpy.ndarray Return a mapping matrix using the given weight.
For the mapping, we use the function get_synapse_mapping, which yields a connection matrix between the drivers and neurons. This mapping is designed to create a non-overlapping synapse matrix that allows parallel measurement of multiple drivers.
- Parameters
weight – Weight to configure the enabled synapses to.
- Returns
Numpy array of weight matrix.
-
measure_syndrv_amplitudes
(connection: pyhxcomm_vx.ConnectionHandle, activations: Union[pyhaldls_vx_v3.PADIEvent.HagenActivation, numpy.ndarray], *, weight: pyhaldls_vx_v3.SynapseWeightQuad.Value = 63, n_runs: int = 5, num_sends: int = 3) → numpy.ndarray Multiply the given activation with a suitable weight matrix to determine the output amplitudes of each driver.
Use the multiplication function with integration on the synaptic input lines. The weight matrix is configured using the function get_synapse_matrix(), and vectors equaling the positioning of drivers on PADI busses are used to characterize each drivers’ outputs. The parameter num_sends repeats the vector, i.e. sends multiple events per driver for getting suitable amplitudes. The experiment is repeated n_runs times.
For readout, we use at least 8 synapse columns per driver, determined by the number of parallel measurements, and return the median of each of those synapse blocks. The returned array of amplitudes has one entry for each synapse driver.
- Parameters
connection – Connection to the chip to run on.
activations – Activation to use in input vector. If an array is given, each of the contained activations is tested. In this case, the returned result will have a second, outer dimension corresponding to the different activations.
weight – Weight to use in synapse matrix.
n_runs – Number of experiments to take mean from.
num_sends – Number of events to send per driver in each measurement.
- Returns
Array of amplitudes of each synapse driver.