bregaldo / pywph

Wavelet Phase Harmonics in PyTorch for Images
BSD 3-Clause "New" or "Revised" License
15 stars 3 forks source link

User Warning concerning casting in wph_operator #7

Open jecampagne opened 5 months ago

jecampagne commented 5 months ago

Dear Bruno, Nice tool! Thanks so much. I'm playing with the denoising.py example, and I get this

pywph/pywph/wph_operator.py:803: UserWarning: Casting complex values to real discards the imaginary part (Triggered internally at /gpfs7kro/gpfslocalsup/src/pub/anaconda-py3/2022.05/pytorch-1.13.0+py3.10.8/pytorch-1.13.0/aten/src/ATen/native/Copy.cpp:250.)
  xpsi1_k1 = xpsi1_k1 - mean1.to(xpsi1_k1.dtype) # Consistent dtype needed

do not know if I should do something... Sincerely yours

bregaldo commented 5 months ago

Hi Jean-Eric, Thanks for raising this issue. This warning shouldn't be a problem and you can safely ignore it. It arises from the casting of complex-valued tensors to real-valued ones, but this (normally) occurs at a stage where imaginary parts are zero anyway. I will better handle this case in the code in future iterations of the package. Best, Bruno