jeshraghian / snntorch

Deep and online learning with spiking neural networks in Python
https://snntorch.readthedocs.io/en/latest/
MIT License
1.35k stars 222 forks source link

'snntorch' has no attribute 'Leaky' #248

Closed robertoshea closed 1 year ago

robertoshea commented 1 year ago

Description

I have just installed snntorch with pip3 I am running the scripts in tutorial 3. I am the error message stating that "AttributeError: module 'snntorch' has no attribute 'Leaky'". I see that none of the spiking neuron types are available (e.g. snn.RLeaky, snn.Alpha etc. are not available as modules). snn.LIF is available.

What I Did

import snntorch as snn
from snntorch import spikeplot as splt
from snntorch import spikegen

import torch
import torch.nn as nn
import matplotlib.pyplot as plt

# layer parameters
num_inputs = 784
num_hidden = 1000
num_outputs = 10
beta = 0.99

# initialize layers
fc1 = nn.Linear(num_inputs, num_hidden)
lif1 = snn.Leaky(beta=beta)

Traceback (most recent call last):
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2023.2.2\plugins\python-ce\helpers\pydev\pydevconsole.py", line 364, in runcode
    coro = func()
           ^^^^^^
  File "<input>", line 1, in <module>
AttributeError: module 'snntorch' has no attribute 'Leaky'
jeshraghian commented 1 year ago

Installing the latest version of snntorch (or anything >0.2.0 should fix this.