This is strange. I am trying to use fft (pytorch_fft) and facing type issues. Below function in fft.py uses python builtin type() function to check type of the tensor, which in pytorch 0.4, gives ‘torch.Tensor’ irrespective of the type of tensor (float, double, int).
def fft(X_re, X_im):
if 'Float' in type(X_re).__name__ :
f = th_fft.th_Float_fft1
elif 'Double' in type(X_re).__name__:
f = th_fft.th_Double_fft1
else:
raise NotImplementedError
return _fft(X_re, X_im, f, 1)
With pytorch 0.3.1:
a = torch.randn(3,4)
>>> type(a)
<class 'torch.FloatTensor'>
>>> a.type()
'torch.FloatTensor'
With pytorch 0.4:
>>> type(a)
<class 'torch.Tensor'>
>>> a.type()
'torch.FloatTensor'