kmheckel / spyx

Spyx: Spiking Neural Networks in JAX
https://spyx.readthedocs.io/en/latest/
MIT License
103 stars 12 forks source link

AttributeError: module 'spyx.axn' has no attribute 'Axon' #29

Closed Dipendra7 closed 7 months ago

Dipendra7 commented 7 months ago

I am experimenting cartpole with spiking neural network with spyx, but i got the following error. could you please assist?


AttributeError Traceback (most recent call last) in <cell line: 4>() 2 init_state = (jnp.zeros(64), jnp.zeros(2)) 3 policy = hk.without_apply_rng(hk.transform(controller)) ----> 4 policy_params = policy.init(rng=key, x=adapter(obs), state=init_state)

2 frames in controller(x, state) 7 core = hk.DeepRNN([ 8 hk.Linear(64, with_bias=False), ----> 9 snn.LIF(64, beta=0.8, activation=spyx.axn.Axon()), 10 hk.Linear(2, with_bias=False), 11 snn.LI(2)

AttributeError: module 'spyx.axn' has no attribute 'Axon'

kmheckel commented 7 months ago

Hi!

You just need to change spyx.axn.Axon() to spyx.axn.arctan() or any of the other surrogate activations. spyx.axn.Axon() is deprecated and I missed this when updating the examples and docs.

Dipendra7 commented 7 months ago

Hi! Thank you for prompt reply , It is working. snn.LIF((64,), beta =0.8,activation=spyx.axn.arctan()),

kmheckel commented 7 months ago

Glad to hear it! I fixed the notebook on the docs as well to resolve this going forward.