neurai.ops package#

Submodules#

neurai.ops.target_vector_operators.diff_all2all(pre_v, post_v, weight, num_pre_neurons, num_post_neurons)#

Operator of gap juction to compute target vectors when connection rule is All2All.

Parameters:
  • pre_v (jnp.ndarray) – The membrane voltage of pre neuron population.

  • post_v (jnp.ndarray) – The membrane voltage of pre neuron population.

  • weight (Union[int, float, jnp.ndarray]) – Matrix with information of synaptic connections’ weight. It has shape of (num_pre_neurons, num_post_neurons). It can be a scalar.

  • num_pre_neurons (int) – The num of neurons of pre neuron population.

  • num_post_neurons (int) – The num of neurons of pre neuron population.

Returns:

  • pre_target_vector (jnp.ndarray) – The target vector. It is used to update the membrane voltage of pre neuron population.

  • post_target_vector (jnp.ndarray) – The target vector. It is used to update the membrane voltage of post neuron population.

neurai.ops.target_vector_operators.diff_coo(pre_v, post_v, weight, structure, num_pre_neurons, num_post_neurons)#

Operator of gap junction to compute target vectors when choosing coo form to represent the structure of synaptic connections and connection rule is not One2One or All2All.

Parameters:
  • pre_v (jnp.ndarray) – The membrane voltage of pre neuron population.

  • post_v (jnp.ndarray) – The membrane voltage of pre neuron population.

  • weight (Union[int, float, jnp.ndarray]) – Vector with information of synaptic connections’ weight. It has the same length with post_ids or post_ids. It can be a scalar.

  • structure (jnp.ndarray) – Structure information of synaptic connections. In this case, structure information is expressed by pre_ids, post_ids.

  • num_pre_neurons (int) – The num of neurons of pre neuron population.

  • num_post_neurons (int) – The num of neurons of pre neuron population.

Returns:

  • pre_target_vector (jnp.ndarray) – The target vector. It is used to update the membrane voltage of pre neuron population.

  • post_target_vector (jnp.ndarray) – The target vector. It is used to update the membrane voltage of post neuron population.

neurai.ops.target_vector_operators.diff_mat(pre_v, post_v, weight, structure, num_pre_neurons, num_post_neurons)#

Operator of gap junction to compute target vectors when choosing mat form to represent the structure of synaptic connections and connection rule is not One2One or All2All.

Parameters:
  • pre_v (jnp.ndarray) – The membrane voltage of pre neuron population.

  • post_v (jnp.ndarray) – The membrane voltage of pre neuron population.

  • weight (Union[int, float, jnp.ndarray]) – Matrix with information of synaptic connections’ weight. It has shape of (num_pre_neurons, num_post_neurons). It can be a scalar.

  • structure (jnp.ndarray) – Matrix with information of synaptic connections’ structure. It has shape of (num_pre_neurons, num_post_neurons).

  • num_pre_neurons (int) – The num of neurons of pre neuron population.

  • num_post_neurons (int) – The num of neurons of pre neuron population.

Returns:

  • pre_target_vector (jnp.ndarray) – The target vector. It is used to update the membrane voltage of pre neuron population.

  • post_target_vector (jnp.ndarray) – The target vector. It is used to update the membrane voltage of post neuron population.

neurai.ops.target_vector_operators.diff_one2one(pre_v, post_v, weight, num_pre_neurons, num_post_neurons)#

Operator of gap juction to compute target vectors when connection rule is One2One.

Parameters:
  • pre_v (jnp.ndarray) – The membrane voltage of pre neuron population.

  • post_v (jnp.ndarray) – The membrane voltage of pre neuron population.

  • weight (Union[int, float, jnp.ndarray]) – Vector with information of synaptic connections’ weight. It has shape of (num_pre_neurons, ) or (num_post_neurons, ). It can be a scalar.

  • num_pre_neurons (int) – The num of neurons of pre neuron population.

  • num_post_neurons (int) – The num of neurons of pre neuron population.

Returns:

  • pre_target_vector (jnp.ndarray) – The target vector. It is used to update the membrane voltage of pre neuron population.

  • post_target_vector (jnp.ndarray) – The target vector. It is used to update the membrane voltage of post neuron population.

neurai.ops.target_vector_operators.event_all2all(pre_values, weight, delay_step, max_delay_step_plus_one, polling_delay_counter, target_buffer, num_pre_neurons, num_post_neurons, is_pre_spike_binary, receptor_type_index, num_receptor)#

Operator to compute target vector when connection rule is All2All.

Parameters:
  • pre_values (jnp.ndarray) – Spikes emitted by pre neuron population.

  • weight (Union[int, float, jnp.ndarray]) – Matrix with information of synaptic connections’ weight. It has shape of (num_pre_neurons, num_post_neurons). It can be a scalar.

  • delay_step (Union[int, jnp.ndarray]) – A fixed matrix that stores the delay values (the unit is time step) of synapses provided by the user. It has shape of (num_pre_neurons, num_post_neurons). It can be a scalar.

  • max_delay_step_plus_one (Union[int, jnp.ndarray]) – The value of max delay in delay_step and plus one.

  • polling_delay_counter (Union[int, jnp.ndarray]) – It serves as a counter for the ring buffer. Its default value is 0 and perform the following calculation at each time step: polling_delay_counter = (polling_delay_counter + 1) % (max_delay_step + 1). It is used to find elements of target_buffer to update or to be selected as target vector.

  • target_buffer (jnp.ndarray) – A buffer used to records the computing results of all time steps. Target vector is selected from target buffer. It has the shape of (max_delay_step_plus_one * num_post_neurons, ). It should be initialized with zeros.

  • num_pre_neurons (int) – The num of neurons of pre neuron population.

  • num_post_neurons (int) – The num of neurons of post neuron population.

  • is_pre_spike_binary (bool) – A flag which represents the state of pre_values. If the elements of pre_values are boolean values or 0/1 (int or float), this argument is given as True. In other cases, it’s given as False.

  • receptor_type_index (Union[jnp.ndarray]) – the receptor type of each synapse. It has shape of (num_pre_neurons, num_post_neurons).

  • num_receptor (int) – The num of the receptor types.

Returns:

  • target_vector (jnp.ndarray) – The target vector. It is used to update the membrane voltage of post neuron population.

  • target_buffer (jnp.ndarray) – The new target_buffer.

  • polling_delay_counter (jnp.ndarray) – The new polling_delay_counter.

neurai.ops.target_vector_operators.event_coo(pre_values, weight, structure, delay_step, max_delay_step_plus_one, polling_delay_counter, target_buffer, num_pre_neurons, num_post_neurons, receptor_type_index, num_receptor)#
Operator to compute target vector when choosing

‘coo’ form to represent the structure of synaptic connections and connection rule is not One2One or All2All.

Parameters:
  • pre_values (jnp.ndarray) – Spikes emitted by pre neuron population.

  • weight (Union[int, float, jnp.ndarray]) – Vector with information of synaptic connections’ weight. It has the same length with post_ids or post_ids. It can be a scalar.

  • structure (Tuple[jnp.ndarray, jnp.ndarray]) – Structure information of synaptic connections. In this case, structure information is expressed by pre_ids, post_ids.

  • delay_step (Union[int, jnp.ndarray]) – A fixed vector that stores the delay values (the unit is time step) of synapses provided by the user. It has the same length with pre_ids or post_ids. It can be a scalar.

  • max_delay_step_plus_one (Union[int, jnp.ndarray]) – The value of max delay in delay_step and plus one.

  • polling_delay_counter (Union[int, jnp.ndarray]) – It serves as a counter for the ring buffer. Its default value is 0 and perform the following calculation at each time step: polling_delay_counter = (polling_delay_counter + 1) % (max_delay_step + 1). It is used to find elements of target_buffer to update or to be selected as target vector.

  • target_buffer (jnp.ndarray) – A buffer used to records the computing results of all time steps. Target vector is selected from target buffer. It has the shape of (max_delay_step_plus_one * num_post_neurons, ). It should be initialized with zeros.

  • num_pre_neurons (int) – The num of neurons of pre neuron population.

  • num_post_neurons (int) – The num of neurons of post neuron population.

  • receptor_type_index (Union[jnp.ndarray]) – the receptor type of each synapse. It has the same length with post_ids or post_ids.

  • num_receptor (int) – The num of the receptor types.

Returns:

  • target_vector (jnp.ndarray) – The target vector. It is used to update the membrane voltage of post neuron population.

  • target_buffer (jnp.ndarray) – The new target_buffer.

  • polling_delay_counter (jnp.ndarray) – The new polling_delay_counter.

neurai.ops.target_vector_operators.event_csr(pre_values, weight, structure, delay_step, max_delay_step_plus_one, polling_delay_counter, target_buffer, num_pre_neurons, num_post_neurons, is_pre_spike_binary, receptor_type_index, num_receptor)#
Operator to compute target vector when choosing

‘csr’ form to represent the structure of synaptic connections and connection rule is not One2One or All2All.

Parameters:
  • pre_values (jnp.ndarray) – Spikes emitted by pre neuron population.

  • weight (Union[int, float, jnp.ndarray]) – Vector with information of synaptic connections’ weight. It has the same length with post_ids. It can be a scalar.

  • structure (Tuple[jnp.ndarray, jnp.ndarray]) – Structure information of synaptic connections. In this case, structure information is expressed by post_ids and pre_indptr.

  • delay_step (Union[int, jnp.ndarray]) – A fixed vector that stores the delay values (the unit is time step) of synapses provided by the user. It has the same length with post_ids. It can be a scalar.

  • max_delay_step_plus_one (Union[int, jnp.ndarray]) – The value of max delay in delay_step and plus one.

  • polling_delay_counter (Union[int, jnp.ndarray]) – It serves as a counter for the ring buffer. Its default value is 0 and perform the following calculation at each time step: polling_delay_counter = (polling_delay_counter + 1) % (max_delay_step + 1). It is used to find elements of target_buffer to update or to be selected as target vector.

  • target_buffer (jnp.ndarray) – A buffer used to records the computing results of all time steps. Target vector is selected from target buffer. It has the shape of (max_delay_step_plus_one * num_post_neurons, ). It should be initialized with zeros.

  • num_pre_neurons (int) – The num of neurons of pre neuron population.

  • num_post_neurons (int) – The num of neurons of post neuron population.

  • is_pre_spike_binary (bool) – A flag which represents the state of pre_values. If the elements of pre_values are boolean values or 0/1 (int or float), this argument is given as True. In other cases, it’s given as False.

  • receptor_type_index (Union[jnp.ndarray]) – the receptor type of each synapse. It has the same length with post_ids.

  • num_receptor (int) – The num of the receptor types.

Returns:

  • target_vector (jnp.ndarray) – The target vector. It is used to update the membrane voltage of post neuron population.

  • target_buffer (jnp.ndarray) – The new target_buffer.

  • polling_delay_counter (jnp.ndarray) – The new polling_delay_counter.

neurai.ops.target_vector_operators.event_mat(pre_values, weight, structure, delay_step, max_delay_step_plus_one, polling_delay_counter, target_buffer, num_pre_neurons, num_post_neurons, is_pre_spike_binary, receptor_type_index, num_receptor)#
Operator to compute target vector when choosing

‘mat’ form to represent the structure of synaptic connections and connection rule is not One2One or All2All.

Parameters:
  • pre_values (jnp.ndarray) – Spikes emitted by pre neuron population.

  • weight (Union[int, float, jnp.ndarray]) – Matrix with information of synaptic connections’ weight. It has shape of (num_pre_neurons, num_post_neurons). It can be a scalar.

  • structure (jnp.ndarray) – Matrix with information of synaptic connections’ structure. It has shape of (num_pre_neurons, num_post_neurons).

  • delay_step (Union[int, jnp.ndarray]) – A fixed matrix that stores the delay values (the unit is time step) of synapses provided by the user. It has shape of (num_pre_neurons, num_post_neurons). It can be a scalar.

  • max_delay_step_plus_one (Union[int, jnp.ndarray]) – The value of max delay in delay_step and plus one.

  • polling_delay_counter (Union[int, jnp.ndarray]) – It serves as a counter for the ring buffer. Its default value is 0 and perform the following calculation at each time step: polling_delay_counter = (polling_delay_counter + 1) % (max_delay_step + 1). It is used to find elements of target_buffer to update or to be selected as target vector.

  • target_buffer (jnp.ndarray) – A buffer used to records the computing results of all time steps. Target vector is selected from target buffer. It has the shape of (max_delay_step_plus_one * num_post_neurons, ). It should be initialized with zeros.

  • num_pre_neurons (int) – The num of neurons of pre neuron population.

  • num_post_neurons (int) – The num of neurons of post neuron population.

  • is_pre_spike_binary (bool) – A flag which represents the state of pre_values. If the elements of pre_values are boolean values or 0/1 (int or float), this argument is given as True. In other cases, it’s given as False.

  • receptor_type_index (Union[jnp.ndarray]) – the receptor type of each synapse. It has shape of (num_pre_neurons, num_post_neurons).

  • num_receptor (int) – The num of the receptor types.

Returns:

  • target_vector (jnp.ndarray) – The target vector. It is used to update the membrane voltage of post neuron population.

  • target_buffer (jnp.ndarray) – The new target_buffer.

  • polling_delay_counter (jnp.ndarray) – The new polling_delay_counter.

neurai.ops.target_vector_operators.event_one2one(pre_values, weight, delay_step, max_delay_step_plus_one, polling_delay_counter, target_buffer, num_pre_neurons, num_post_neurons, receptor_type_index, num_receptor)#

Operator to compute target vector when connection rule is One2One.

Parameters:
  • pre_values (jnp.ndarray) – Spikes emitted by pre neuron population.

  • weight (Union[int, float, jnp.ndarray]) – Vector with information of synaptic connections’ weight. It has shape of (num_pre_neurons, ) or (num_post_neurons, ). It can be a scalar.

  • delay_step (Union[int, jnp.ndarray]) – A fixed vector that stores the delay values (the unit is time step) of synapses provided by the user. It has shape of (num_pre_neurons, ) or (num_post_neurons, ). It can be a scalar.

  • max_delay_step_plus_one (Union[int, jnp.ndarray]) – The value of max delay in delay_step and plus one.

  • polling_delay_counter (Union[int, jnp.ndarray]) – It serves as a counter for the ring buffer. Its default value is 0 and perform the following calculation at each time step: polling_delay_counter = (polling_delay_counter + 1) % (max_delay_step + 1). It is used to find elements of target_buffer to update or to be selected as target vector.

  • target_buffer (jnp.ndarray) – A buffer used to records the computing results of all time steps. Target vector is selected from target buffer. It has the shape of (max_delay_step_plus_one * num_post_neurons, ). It should be initialized with zeros.

  • num_pre_neurons (int) – The num of neurons of pre neuron population.

  • num_post_neurons (int) – The num of neurons of post neuron population.

  • receptor_type_index (Union[jnp.ndarray]) – the receptor type of each synapse. It has shape of (num_pre_neurons, ) or (num_post_neurons, ).

  • num_receptor (int) – The num of the receptor types.

Returns:

  • target_vector (jnp.ndarray) – The target vector. It is used to update the membrane voltage of post neuron population.

  • target_buffer (jnp.ndarray) – The new target_buffer.

  • polling_delay_counter (jnp.ndarray) – The new polling_delay_counter.

Module contents#