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

Fix to input_type node of CubaLIF neurons #107

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions nir/ir/neuron.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ def __post_init__(self):
), "All parameters must have the same shape"
# If w_in is a scalar, make it an array of same shape as v_threshold
self.w_in = np.ones_like(self.v_threshold) * self.w_in
self.input_type = {"input": np.array(self.v_threshold.shape)}
self.output_type = {"output": np.array(self.v_threshold.shape)}
self.input_type = {"input": np.array([np.size(self.v_threshold)])}
self.output_type = {"output": np.array([np.size(self.v_threshold)])}


@dataclass(eq=False)
Expand Down
10 changes: 5 additions & 5 deletions paper/03_rnn/rockpool_apply.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -107,21 +107,21 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 34,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"100%|██████████| 140/140 [00:13<00:00, 10.58it/s]"
"100%|██████████| 140/140 [00:13<00:00, 10.20it/s]"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"n_correct 100 out of 140 (71.42857142857143%)\n"
"n_correct 108 out of 140 (77.14285714285715%)\n"
]
},
{
Expand All @@ -143,7 +143,7 @@
" sample = single_sample[0].numpy()[0] # shape: (256, 12)\n",
"\n",
" output, rec_dict = net(torch.tensor(sample))\n",
" n_output_spikes = np.sum(output.detach().numpy(), axis=1)\n",
" n_output_spikes = np.sum(output.squeeze().detach().numpy(), axis=0)\n",
"\n",
" predicted_label = int(np.argmax(n_output_spikes))\n",
" actual_label = int(single_sample[1])\n",
Expand All @@ -160,7 +160,7 @@
},
{
"cell_type": "code",
"execution_count": 32,
"execution_count": 35,
"metadata": {},
"outputs": [
{
Expand Down
Loading