From 0139f4c9ff8fe7330cebc1dd442f60c841c672fc Mon Sep 17 00:00:00 2001 From: Hananel Hazan Date: Mon, 5 Oct 2020 20:29:49 -0400 Subject: [PATCH] Reduce network/layer dependency on the existence of the Input layer. Enable each layer to rely on external input via injecting voltage only without the need to use the input parameter. --- bindsnet/network/network.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bindsnet/network/network.py b/bindsnet/network/network.py index 643b1c40..3f821f39 100644 --- a/bindsnet/network/network.py +++ b/bindsnet/network/network.py @@ -354,7 +354,10 @@ def run( # Get input to this layer (one-step mode). current_inputs.update(self._get_inputs(layers=[l])) - self.layers[l].forward(x=current_inputs[l]) + if l in current_inputs: + self.layers[l].forward(x=current_inputs[l]) + else: + self.layers[l].forward(x=torch.zeros(self.layers[l].s.shape)) # Clamp neurons to spike. clamp = clamps.get(l, None)