onnx / tutorials

Tutorials for creating and using ONNX models
Apache License 2.0
3.39k stars 629 forks source link

RuntimeError: ONNX export failed: Couldn’t export Python operator qfn #256

Closed captain81 closed 3 years ago

captain81 commented 3 years ago

Hi, I’m trying to convert a pytorch model to onnx, but the conversion gives the following error:

RuntimeError: ONNX export failed: Couldn’t export Python operator qfn

The definition for qfn is:

class qfn(torch.autograd.Function): @staticmethod def forward(ctx, input, k): n = float(2*k - 1) out = torch.round(input n) / n return out

@staticmethod def backward(ctx, grad_output): grad_input = grad_output.clone() return grad_input, None

prasanthpul commented 3 years ago

Sounds like you are using torch.onnx.export? Please file an issue in https://github.com/pytorch/pytorch