fangwei123456 / spikingjelly

SpikingJelly is an open-source deep learning framework for Spiking Neural Network (SNN) based on PyTorch.
https://spikingjelly.readthedocs.io
Other
1.32k stars 237 forks source link

BatchNorm1d issue #477

Open JonathanCourtois opened 10 months ago

JonathanCourtois commented 10 months ago

Issue type

Description Hi, I found a strange issue in the BatchNorm1d. When using spikingjelly in multistep mode this happens : raise ValueError(f'expected x with shape [T, N, C, L] or [T, N, C], but got x with shape {x.shape} {x.dim()}!') At : https://github.com/fangwei123456/spikingjelly/blob/cb1cee00334ebeca101a155aee694252f85543a8/spikingjelly/activation_based/layer.py#L463

It's the only modification in the commit that produce error I suggest this if it's the comportment desired : if x.dim() > 4 or x.dim() < 3: But I don't understand why 'L' is not necessary ? @fangwei123456

Thank you for your work !

fangwei123456 commented 9 months ago

https://pytorch.org/docs/stable/generated/torch.nn.BatchNorm1d.html#batchnorm1d

image