From 756e63773f84c52ac363c09417f42af72de9d09c Mon Sep 17 00:00:00 2001 From: GaboFGuerra <83413252+GaboFGuerra@users.noreply.github.com> Date: Tue, 27 Sep 2022 23:22:09 +0200 Subject: [PATCH] Expose noise amplitude for SCIF (#383) * Enable exception proc_map, working with dataclasses, etc. Signed-off-by: GaboFGuerra * Integrate YS's changes to enable req_pause. Signed-off-by: GaboFGuerra * Expose noise amplitude at the process level for SCIF. Signed-off-by: GaboFGuerra * Remove prints from req_pause debug. Signed-off-by: GaboFGuerra * Solve lint issue. Signed-off-by: GaboFGuerra --- src/lava/proc/scif/process.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/lava/proc/scif/process.py b/src/lava/proc/scif/process.py index d4a4ae29c..38175e8fd 100644 --- a/src/lava/proc/scif/process.py +++ b/src/lava/proc/scif/process.py @@ -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. @@ -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)) @@ -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): @@ -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)