Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose noise amplitude for SCIF #383

Merged
merged 6 commits into from
Sep 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
srrisbud marked this conversation as resolved.
Show resolved Hide resolved
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)