Python builtin type() difference in pytorch 0.4 and 0.3.1 (and earlier)

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'

This is expected behavior.
Since Variables and tensors were merged, you should now use tensor.type() or isinstance() instead of type(). This is described in the Migration Guide.

fft() function is from pytorch_fft library. Will make the changes then. Thanks.

Ah OK, didn’t realize that.
It seems the repo is abandoned. Maybe you could use the built-in method: torch.fft.