RudyMorel / scattering_spectra

Scattering Spectra used for the analysis and generation of time-series
MIT License
25 stars 8 forks source link

Issue with `normalize='each_ps'` #6

Closed alisiahkoohi closed 10 months ago

alisiahkoohi commented 10 months ago

Hi Rudy,

Enabling normalize='each_ps' while providing nchunks runs into some size mismatch error:

from scatspectra import analyze, load_data

x = load_data(model_name='fbm', R=128, T=5200, H=0.5)
analyze(x, normalize='each_ps', cuda=True, nchunks=64)

results in

File /***/lib/python3.11/site-packages/scatspectra/layers/layers_basics.py:24, in NormalizationLayer.forward(self, x)
     22 if self.sigma is None:
     23     raise ValueError("Normalization sigma should have been provided")
---> 24 return x / self.sigma[(..., *(None,) * (x.ndim - 1 - self.dim))]

RuntimeError: The size of tensor a (2) must match the size of tensor b (128) at non-singleton dimension 0

but without normalize='each_ps' , i.e., analyze(x, cuda=True, nchunks=64) runs okay.

Could you please help with this? Thank you in advance.

RudyMorel commented 10 months ago

Hi Ali, Thank you for pointing out this bug which I fixed in the new commit. I added this as a test. Thanks!

alisiahkoohi commented 10 months ago

Thanks!!!

On Wed, Dec 6, 2023 at 22:23 Rudy Morel @.***> wrote:

Closed #6 https://github.com/RudyMorel/scattering_spectra/issues/6 as completed.

— Reply to this email directly, view it on GitHub https://github.com/RudyMorel/scattering_spectra/issues/6#event-11176697836, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFLLMOXLUBQUQESMLUBZF63YIFAETAVCNFSM6AAAAABAKKUKX2VHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJRGE3TMNRZG44DGNQ . You are receiving this because you authored the thread.Message ID: @.***>