Skip to content

Commit 4f346cf

Browse files
committed
Added cyclical graph to README, update to setup file for pypi
1 parent b201b60 commit 4f346cf

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Installing PySNN requires a Python version of 3.6 or higher, Python 2 is not sup
5050

5151
## __Network Structure__
5252

53-
Intention is to mirror most of the structure of PyTorch framework. As an example, the followig piece of code shows how much a Spiking Neural Network definition in PySNN looks like a network definition in PyTorch:
53+
Intention is to mirror most of the structure of PyTorch framework. As an example, the followig piece of code shows how much a Spiking Neural Network definition in PySNN looks like a network definition in PyTorch. The network's graph is cyclical, due to the feedback connection from the output neurons to the hidden neurons.
5454

5555
```python
5656
class Network(SNNNetwork):
@@ -70,12 +70,17 @@ class Network(SNNNetwork):
7070
self.neuron2 = LIFNeuron((batch_size, 1, n_out), *neuron_dynamics)
7171
self.add_layer("fc2", self.mlp2_c, self.neuron2)
7272

73+
# Feedback connection from neuron 2 to neuron 1
74+
self.mlp2_prev = Linear(n_out, n_hidden, *c_dynamics)
75+
self.add_layer("fc2_back", self.mlp2_prev, self.neuron1)
76+
7377
def forward(self, input):
7478
spikes, trace = self.input(input)
7579

7680
# Layer 1
77-
spikes, trace = self.mlp1_c(spikes, trace)
78-
spikes, trace = self.neuron1(spikes, trace)
81+
x_prev, _ = self.mlp2_prev(self.neuron2.spikes, self.neuron2.trace)
82+
x_forw, _ = self.mlp1_c(x, t)
83+
x, t = self.neuron1([x_forw, x_rec, x_prev])
7984

8085
# Layer out
8186
spikes, trace = self.mlp2_c(spikes, trace)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
setup(
2929
name="pysnn",
30-
version="0.1",
30+
version="0.1.1",
3131
description="Framework for engineering and simulating spiking neural networks, built on top of PyTorch.",
3232
long_description=readme,
3333
long_description_content_type="text/markdown",

0 commit comments

Comments
 (0)