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

TypeError when using adrf neurons #277

Closed
felixthoe opened this issue Jan 9, 2024 · 1 comment · Fixed by #308
Closed

TypeError when using adrf neurons #277

felixthoe opened this issue Jan 9, 2024 · 1 comment · Fixed by #308
Assignees
Labels
1-bug Something isn't working

Comments

@felixthoe
Copy link
Contributor

Describe the bug
There seems to be a small bug in the implementation of the adrf neuron (lava-dl/src/lib/dl/slayer/neuron/adrf.py). The Neuron.forward() function calls self.spike(real, imag, threshold + refractory), while it should be self.spike(real, imag, threshold, refractory) according to the definition of the function Neuron.spike() in the same file.

To reproduce current behavior
Steps to reproduce the behavior:

  1. When I run this code...
import lava.lib.dl.slayer as slayer
import torch
# choose arbitrary neuron parameters
my_neuron = slayer.neuron.adrf.Neuron(
    threshold = 1,
    threshold_step = 0.2,
    period = 4,
    decay = 0.3,
    threshold_decay = 0.3,
    refractory_decay = 0.3
    )
# some random, complex input of shape ((N,C,T),(N,C,T))
input = (torch.randn((16, 10, 50)), torch.randn((16,10,50)))
output = my_neuron(input)
  1. I get this error ...
 File "/home/ujrrg/miniconda3/envs/lava/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/home/ujrrg/miniconda3/envs/lava/lib/python3.9/site-packages/lava/lib/dl/slayer/neuron/adrf.py", line 677, in forward
    return self.spike(real, imag, threshold + refractory)
TypeError: spike() missing 1 required positional argument: 'refractory'
@felixthoe felixthoe added the 1-bug Something isn't working label Jan 9, 2024
@PhilippPlank
Copy link
Contributor

Great catch. Feel free to create a pull request for this fix :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1-bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants