Skip to content

An error occurred while updating the network with MSTDP learning rule #488

@AptX395

Description

@AptX395

I submitted an issue #487 that explained an error I had encountered.

After investigation, I think it is not because the network parameters were set incorrectly. I replied the specific disgussion in #487.

I think this problem may have occurred in the update phase of the network rather than in the forward propagation phase of the network.

My code logic is to separate forward propagation from network updates. That is, I set self._net.train(mode = False) before calling self._net.run() as follows:

self._net.train(mode = False)
spike = self._encoder(x)    # PoissonEncoder
input = {"input": spike}
self._net.run(input, self._time, one_step = True)

to make the network behave like:

with torch.no_grad():
    model.forward(x)

in PyTorch.


My code works fine for forward propagation without any errors. But when I update network parameters as follows:

self._net.train(mode = True)

for connection in self._net.connections:
    self._net.connections[connection].update(reward = reward)

I get the error mentioned in #487.

The most critical error message is:

  File "/usr/local/anaconda3/envs/snn_rl/lib/python3.7/site-packages/bindsnet/learning/learning.py", line 669, in _conv2d_connection_update
    self.eligibility = self.eligibility.view(self.connection.w.size())
RuntimeError: shape '[32, 4, 8, 8]' is invalid for input of size 262144

What is the cause of this error?

I really appreciate your help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions