# Does HPU support complex datatype in torch

**URL:** https://forum.habana.ai/t/does-hpu-support-complex-datatype-in-torch/1202
**Category:** Training
**Tags:** pytorch
**Created:** [May 28, 2024, 5:04pm UTC](https://forum.habana.ai/t/does-hpu-support-complex-datatype-in-torch/1202 "2024-05-28T17:04:59Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Kai\_Qiu](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.habana.ai/kai_qiu/32/230_2.png) [@Kai\_Qiu](https://forum.habana.ai/u/Kai_Qiu)
#### Post date: [May 28, 2024, 5:04pm UTC](https://forum.habana.ai/t/does-hpu-support-complex-datatype-in-torch/1202/1 "2024-05-28T17:04:59Z")

</div>

Does hpu support torch.stft()?

---

<div class="post-metadata">

### Author: ![Sayantan\_S](https://avatars.discourse-cdn.com/v4/letter/s/a3d4f5/32.png) [@Sayantan\_S](https://forum.habana.ai/u/Sayantan_S)
#### Post date: [May 28, 2024, 7:58pm UTC](https://forum.habana.ai/t/does-hpu-support-complex-datatype-in-torch/1202/2 "2024-05-28T19:58:39Z")

</div>

No complex datatype isnt supported.

workaround: If you have a model with stft, you can run the stft on cpu (by moving its input to cpu `input = input.to('cpu')`, assuming real number inputs, and maybe setting `return_complex=False`). Once stft is done on CPU, you can move back the results on HPU and continue the rest of the model

```auto
>>> import habana_frameworks.torch.core as htcore
>>> torch.stft(torch.tensor([2,3,2,3,4,2,3,2.0]).to('hpu'), 8, return_complex=False)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.10/dist-packages/torch/functional.py", line 660, in stft
    return _VF.stft(input, n_fft, hop_length, win_length, window, # type: ignore[attr-defined]
RuntimeError: Complex datatype is not supported on HPU device.
>>> torch.stft(torch.tensor([2,3,2,3,4,2,3,2.0]).to('hpu'), 8, return_complex=True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.10/dist-packages/torch/functional.py", line 660, in stft
    return _VF.stft(input, n_fft, hop_length, win_length, window, # type: ignore[attr-defined]
RuntimeError: Complex datatype is not supported on HPU device.
>>>

```
