Custom operators (RoiPooling) with ONNX

I have a model with a custom RoiPooling operator that inherits from torch.autograd.Function. When trying to convert the pytorch model to caffe2, I’m getting the error:

  File "/home/thomasbalestri/PycharmProjects/pytorch-faster_rcnn/tools/../lib/nets/network.py", line 110, in _roi_pool_layer
    return RoIPoolFunction(cfg.POOLING_SIZE, cfg.POOLING_SIZE, 1. / 16.)(bottom, rois)
RuntimeError: Tracing of legacy functions is not supported

I see that there’s a list of supported operators here. Does this mean that there’s no way to export pytorch models with custom operators to caffe2?

Hi @Feynman27, right now, we don’t support neither custom operators nor legacy operators.

For custom operators and legacy operators, later we may expose APIs to allows users to define the translation rules.

Is there any progress on this since Sep 2017? If I have a custom function with forward and backward passes, how can I export it to onnx?