Open Roger-GOAT opened 2 years ago
Thank you!
It seems the vanila AE is projecting the input matrices into spurious representations that resulted in "NaN" values when fitting the low-dimensional linear regression.
The code in current line 427 of the model.py filters the nan values by assigning 0 values:
offset[torch.isnan(offset)], gamma[torch.isnan(gamma)] = 0, 0
I guess the error is raised by this line of code. The good news is that a safer nan filtering function (i.e., torch.nan_to_num) has been provided by pytorch since version >= 1.8, updated in veloAE with the hope to tackle the issue.
Updated the codes with the following nan filtering operations in model.py
:
if torch.any(nans_offset) or torch.any(nans_gamma):
version_1_8 = sum([int(this) >= that for this,that in zip(torch.__version__.split('.')[:2], [1, 8])]) == 2
if version_1_8:
offset = torch.nan_to_num(offset)
gamma = torch.nan_to_num(gamma)
else:
offset = torch.where(nans_offset, torch.zeros_like(offset), offset)
gamma = torch.where(nans_gamma, torch.zeros_like(gamma), gamma)
Hope it helps!
Hi dear team, thanks for the package. I get an error could you mind give some tips.