How do we add "opset" to graph context

There are many references for opset in “torch/onnx/symbolic_helper.py”. For example in _slice_helper with g.opset <= 9.

During ONNX conversion actual graph context that is received here is missing opset reference, so we get an error: AttributeError: ‘torch._C.Graph’ object has no attribute ‘opset’.

So is there any way to add “opset” to graph context.

Thanks in advance.

.opset seems to be an attribute of GraphContext, not Graph as seen here and here. Internally the Graph is another attribute as described here.

aha. I got that. I realized this was with using MMCV 1.7. And they also have an update for this issue with the upcoming version. Thank you for the clarification.