RuntimeError: real is not implemented for tensors with non-complex dtypes

493 Views Asked by At

I have installed warpctc module. Then inside home/sultan/Desktop/Adversarial-ASR-Attack/venv/lib/python3.8/sitepackages/art/estimators/speech_recognition/pytorch_deep_speech.py" I have written the following code:

def magphase ( D, *, power= 1 ):
mag = torch.abs ( D)
zeros_to_ones = mag == 0
mag_nonzero = mag + zeros_to_ones
phase = torch.empty_like(D, dtype=torch.complex64)
phase.real = D.real / mag_nonzero + zeros_to_ones
phase.imag = D.imag / mag_nonzero
mag **= power return mag, phase

But when I am calling this function spectrogram, _ = magphase(transformed_input), I am getting following error:

 RuntimeError: real is not implemented for tensors with non-complex dtypes.

What can be probable solution? I am new to pytorch.

0

There are 0 best solutions below