eloimoliner / CQT_pytorch

Pytorch implementation of the invertible CQT based on Non-stationary Gabor filters
29 stars 0 forks source link

Clip error #6

Closed MordehayM closed 3 months ago

MordehayM commented 3 months ago

Hi, I ran your example on readme and got the following error:

Cannot cast ufunc 'clip' output from dtype('float64') to dtype('int64') with casting rule 'same_kind' numpy._core._exceptions._UFuncOutputCastingError: Cannot cast ufunc 'clip' output from dtype('float64') to dtype('int64') with casting rule 'same_kind'

During handling of the above exception, another exception occurred:

File "/home/dsi/moradim/audio-inpainting-diffusion/my_tests/CQT_nsgt_test.py", line 10, in cqt=CQT_nsgt(numocts, binsoct, mode="matrix_complete",fs=fs, audio_len=Ls, device="cuda", dtype=torch.float32) numpy._core._exceptions._UFuncOutputCastingError: Cannot cast ufunc 'clip' output from dtype('float64') to dtype('int64') with casting rule 'same_kind'

MordehayM commented 3 months ago

OK, if figure it out. you must replace this line: https://github.com/eloimoliner/CQT_pytorch/blob/1f2e9f649202693c97d425dcc9d964ba24174212/cqt_nsgt_pytorch/nsgfwin.py#L94

with: M = np.clip(M, min_win, np.inf).astype(int)