'PyTorch convert function for op 'fft_rfftn' not implemented

I am trying to convert a pretrained pytorch model to coreml. I am using coremltools to do this. This is my code.

import torch
import coremltools as ct
traced_model = torch.jit.load("a.jit")
model = ct.convert(traced_model, 
          inputs=[ct.TensorType(shape=image.shape), ct.TensorType(shape=mask.shape)])

I am getting this error "PyTorch convert function for op 'fft_rfftn' not implemented." How can I solve this?



Solution 1:[1]

Try use my project: RosaKit, there is implemented STFT, it's might help.

Solution 2:[2]

Coreml doesn't yet support fft. So you can't convert a model with fft to coreml

The missing fft layer issue is tracked here https://github.com/apple/coremltools/issues/1311

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dmytro Hrebeniuk
Solution 2 vozman