Confusion about ONNX and JIT

Hello I have a few questions regarding the workings of ONNX.

  1. Let’s say I have a DNN that uses an activation function not implemented in PyTorch (a.k.a maxout). If this operation is implemented by using operators that ONNX supports (max, view, etc), will this cause any sort of problem?

  2. Is there a way to implement a function inside the DNN that has an flow-control statement (if, else) and export it to ONNX?

  3. Is JIT connected to ONNX in any way? Adding flow-control statements and custom operators in JIT seems very easy, is there a way to connect the 2 so that I can use operators created in JIT exporting them to ONNX?

Thanks in advance!!

I know a simple if inside a script works in the latest ONNX

@torch.jit.script
def yolo_resize_helper(net_h, net_w, im_h, im_w):
    if net_w / im_w < net_h / im_h:
        new_w = net_w
        new_h = ((im_h * net_w) / im_w).floor()
    else:
        new_h = net_h
        new_w = ((im_w * net_h) / im_h).floor()
    return new_h, new_w

But something more complicated, e.g. recursive scripts, I am trying to figure out myself.