Tips narrowing down problematic code snippet that is failing to compile to ONNX?

So I’m trying to convert a relatively complex model to ONNX. I’m currently getting the following error:

File ~/Library/Caches/pypoetry/virtualenvs/efficientconformer-bpIwAhA4-py3.9/lib/python3.9/site-packages/torch/onnx/, in transpose(g, self, dim0, dim1)
    558     return"transpose", self, dim0_i=dim0, dim1_i=dim1, overload_name="int")
    559 else:
--> 560     raise RuntimeError("Unsupported: ONNX export of transpose for tensor "
    561                        "of unknown rank.")

My current plan of action is to track which .transpose() call in Python is on a “tensor of unkown rank”, and somehow make that rank known to the JIT compiler (or possibly modify the JIT graph directly). But there are many .transpose() calls.

But I’m actually not sure how to narrow it down to which one it is, hence my question here!