Skip to content

Commit

Permalink
Expose noise amplitude for SCIF (#383)
Browse files Browse the repository at this point in the history
* Enable exception proc_map, working with dataclasses, etc.

Signed-off-by: GaboFGuerra <[email protected]>

* Integrate YS's changes to enable req_pause.

Signed-off-by: GaboFGuerra <[email protected]>

* Expose noise amplitude at the process level for SCIF.

Signed-off-by: GaboFGuerra <[email protected]>

* Remove prints from req_pause debug.

Signed-off-by: GaboFGuerra <[email protected]>

* Solve lint issue.

Signed-off-by: GaboFGuerra <[email protected]>
  • Loading branch information
GaboFGuerra authored Sep 27, 2022
1 parent 15c2574 commit ccf271a
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/lava/proc/scif/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ def __init__(
shape: ty.Tuple[int, ...],
step_size: ty.Optional[int] = 1,
theta: ty.Optional[int] = 4,
neg_tau_ref: ty.Optional[int] = -5) -> None:
neg_tau_ref: ty.Optional[int] = -5,
noise_amplitude: ty.Optional[int] = 0) -> None:
"""
Stochastic Constraint Integrate and Fire neuron Process.
Expand Down Expand Up @@ -51,8 +52,7 @@ def __init__(
int))
self.state = Var(shape=shape, init=np.zeros(shape=shape).astype(int))
self.spk_hist = Var(shape=shape, init=np.zeros(shape=shape).astype(int))
self.noise_ampl = Var(shape=shape, init=np.zeros(
shape=shape).astype(int))
self.noise_ampl = Var(shape=shape, init=noise_amplitude)

self.step_size = Var(shape=shape, init=int(step_size))
self.theta = Var(shape=(1,), init=int(theta))
Expand All @@ -72,12 +72,14 @@ def __init__(self,
shape: ty.Tuple[int, ...],
step_size: ty.Optional[int] = 1,
theta: ty.Optional[int] = 4,
neg_tau_ref: ty.Optional[int] = -5):
neg_tau_ref: ty.Optional[int] = -5,
noise_amplitude: ty.Optional[int] = 0):

super(CspScif, self).__init__(shape=shape,
step_size=step_size,
theta=theta,
neg_tau_ref=neg_tau_ref)
neg_tau_ref=neg_tau_ref,
noise_amplitude=noise_amplitude)


class QuboScif(AbstractScif):
Expand All @@ -91,10 +93,12 @@ def __init__(self,
cost_diag: npty.NDArray,
step_size: ty.Optional[int] = 1,
theta: ty.Optional[int] = 4,
neg_tau_ref: ty.Optional[int] = -5):
neg_tau_ref: ty.Optional[int] = -5,
noise_amplitude: ty.Optional[int] = 0):

super(QuboScif, self).__init__(shape=shape,
step_size=step_size,
theta=theta,
noise_amplitude=noise_amplitude,
neg_tau_ref=neg_tau_ref)
self.cost_diagonal = Var(shape=shape, init=cost_diag)

0 comments on commit ccf271a

Please sign in to comment.