Skip to content

Commit

Permalink
Fix conv python model to send() before recv() (#751)
Browse files Browse the repository at this point in the history
Co-authored-by: Gavin Parpart <[email protected]>
  • Loading branch information
2 people authored and epaxon committed Oct 24, 2023
1 parent c293464 commit db74c7f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/lava/proc/conv/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ class AbstractPyConvModel(PyLoihiProcessModel):
num_weight_bits: np.ndarray = LavaPyType(np.ndarray, np.int8, precision=5)

def run_spk(self) -> None:
if self.a_buf is None:
self.a_buf = np.zeros_like(self.a_out.shape)

self.a_out.send(self.a_buf)

if self.num_message_bits.item() > 0:
s_in = self.s_in.recv()
else:
Expand All @@ -43,10 +48,6 @@ def run_spk(self) -> None:
self.groups[0]
)

if self.a_buf is None:
self.a_buf = np.zeros_like(a_out)

self.a_out.send(self.a_buf)
self.a_buf = self.clamp_precision(a_out)

def clamp_precision(self, x: np.ndarray) -> np.ndarray:
Expand Down

0 comments on commit db74c7f

Please sign in to comment.