[ONNX] Update ACPT to support Python 3.11
Labels: module: onnx, triaged, onnx-triaged, release notes: onnx

### 🚀 The feature, motivation and pitch

[Azure Container for PyTorch (aka ACPT)](https://learn.microsoft.com/en-us/azure/machine-learning/resource-azure-container-for-pytorch?view=azureml-api-2) is currently distributed using python 3.8/3.9. Although this is ok for Pytorch 1.x series, the latest PyTorch 2.x leverages Python 3.11 features for better graph lowering from `torch.nn.Module` to `torch.fx.GraphModule`. It also has model transformation/optimization that are better maintained for newer python versions. Below is a list of several places in which we can see Dynamo forking behavior between old (mostly 3.8 and 3.9) and newer python versions (3.10 and 3.11)

```bash
(ptca) root@88c3e49b4bcf:/opt/pytorch# grep sys\.version_info torch/_dynamo -Rn
torch/_dynamo/bytecode_transformation.py:114:    inst = "JUMP_FORWARD" if sys.version_info >= (3, 11) else "JUMP_ABSOLUTE"
torch/_dynamo/bytecode_transformation.py:144:    if sys.version_info >= (3, 11):
torch/_dynamo/bytecode_transformation.py:162:    if sys.version_info >= (3, 11):
torch/_dynamo/bytecode_transformation.py:168:    if sys.version_info < (3, 8) and n >= 4:
torch/_dynamo/bytecode_transformation.py:170:    if sys.version_info < (3, 10) and n >= 5:
torch/_dynamo/bytecode_transformation.py:196:    if sys.version_info >= (3, 11):
torch/_dynamo/bytecode_transformation.py:208:    if sys.version_info >= (3, 11):
torch/_dynamo/bytecode_transformation.py:222:    assert sys.version_info < (3, 10)
torch/_dynamo/bytecode_transformation.py:244:    assert sys.version_info >= (3, 10) and sys.version_info < (3, 11)
torch/_dynamo/bytecode_transformation.py:294:    assert sys.version_info >= (3, 11)
torch/_dynamo/bytecode_transformation.py:441:    if sys.version_info >= (3, 11):
torch/_dynamo/bytecode_transformation.py:463:        if sys.version_info < (3, 10):
torch/_dynamo/bytecode_transformation.py:474:        if sys.version_info >= (3, 10):
torch/_dynamo/bytecode_transformation.py:503:    if sys.version_info < (3, 11):
torch/_dynamo/bytecode_transformation.py:538:                if sys.version_info < (3, 10):
torch/_dynamo/bytecode_transformation.py:540:                elif sys.version_info < (3, 11):
torch/_dynamo/bytecode_transformation.py:550:                    if sys.version_info < (3, 11):
torch/_dynamo/bytecode_transformation.py:558:                    if sys.version_info >= (3, 11) and "BACKWARD" in inst.opname:
torch/_dynamo/bytecode_transformation.py:560:                if sys.version_info >= (3, 10):
torch/_dynamo/bytecode_transformation.py:740:            assert sys.version_info >= (3, 11)
torch/_dynamo/bytecode_transformation.py:864:    if sys.version_info >= (3, 11):
torch/_dynamo/bytecode_transformation.py:922:    if sys.version_info < (3, 11):
torch/_dynamo/bytecode_transformation.py:955:            if sys.version_info >= (3, 11):
torch/_dynamo/bytecode_transformation.py:1001:    if sys.version_info >= (3, 11):
torch/_dynamo/bytecode_transformation.py:1004:    if sys.version_info >= (3, 10):
torch/_dynamo/bytecode_transformation.py:1008:    if sys.version_info >= (3, 11):
torch/_dynamo/bytecode_transformation.py:1040:    if sys.version_info >= (3, 11):
torch/_dynamo/bytecode_transformation.py:1055:    if sys.version_info < (3, 10):
torch/_dynamo/bytecode_transformation.py:1065:    if sys.version_info >= (3, 11):
torch/_dynamo/bytecode_transformation.py:1081:    if sys.version_info >= (3, 11):
torch/_dynamo/bytecode_transformation.py:1087:        if sys.version_info < (3, 11):
torch/_dynamo/resume_execution.py:64:            "NOP" if sys.version_info < (3, 11) else "PUSH_EXC_INFO"
torch/_dynamo/resume_execution.py:78:        if sys.version_info < (3, 11):
torch/_dynamo/resume_execution.py:105:        if sys.version_info < (3, 9):
torch/_dynamo/resume_execution.py:113:        elif sys.version_info < (3, 11):
torch/_dynamo/resume_execution.py:161:        if sys.version_info < (3, 9):
torch/_dynamo/resume_execution.py:178:        elif sys.version_info < (3, 11):
torch/_dynamo/resume_execution.py:355:        is_py311_plus = sys.version_info >= (3, 11)
torch/_dynamo/resume_execution.py:440:                if sys.version_info >= (3, 11):
torch/_dynamo/resume_execution.py:507:        if sys.version_info >= (3, 11):
torch/_dynamo/output_graph.py:774:        if sys.version_info >= (3, 11):
torch/_dynamo/output_graph.py:1288:        if sys.version_info >= (3, 11) and kind in (
torch/_dynamo/symbolic_convert.py:214:    if sys.version_info < (3, 9):
torch/_dynamo/symbolic_convert.py:467:            if sys.version_info >= (3, 11) and inst.opname == "CALL":
torch/_dynamo/symbolic_convert.py:489:            if sys.version_info >= (3, 11) and inst.opname == "CALL":
torch/_dynamo/symbolic_convert.py:668:        if sys.version_info >= (3, 11):
torch/_dynamo/symbolic_convert.py:846:        if sys.version_info >= (3, 11):
torch/_dynamo/symbolic_convert.py:1156:        if sys.version_info >= (3, 11):
torch/_dynamo/symbolic_convert.py:1200:        if sys.version_info >= (3, 11):
torch/_dynamo/symbolic_convert.py:1437:        if sys.version_info < (3, 11):
torch/_dynamo/symbolic_convert.py:1440:        if sys.version_info >= (3, 11):
torch/_dynamo/symbolic_convert.py:1664:            if sys.version_info < (3, 11):
torch/_dynamo/symbolic_convert.py:1668:            if sys.version_info < (3, 11):
torch/_dynamo/symbolic_convert.py:1719:        if sys.version_info >= (3, 11):
torch/_dynamo/symbolic_convert.py:1802:        if sys.version_info >= (3, 11):
torch/_dynamo/symbolic_convert.py:1970:        if sys.version_info >= (3, 10):
torch/_dynamo/symbolic_convert.py:2141:        if sys.version_info >= (3, 11):
torch/_dynamo/symbolic_convert.py:2320:        if sys.version_info >= (3, 11):
torch/_dynamo/variables/misc.py:1053:        if sys.version_info < (3, 11):
torch/_dynamo/codegen.py:251:        if push_null and sys.version_info >= (3, 11):
torch/_dynamo/codegen.py:279:        assert sys.version_info >= (3, 11)
torch/_dynamo/codegen.py:292:        if sys.version_info >= (3, 11) and push_null:
torch/_dynamo/codegen.py:300:        if sys.version_info < (3, 11):
torch/_dynamo/codegen.py:347:        if sys.version_info >= (3, 11):
torch/_dynamo/bytecode_analysis.py:13:if sys.version_info >= (3, 9):
torch/_dynamo/bytecode_analysis.py:15:if sys.version_info >= (3, 11):
torch/_dynamo/bytecode_analysis.py:64:    if sys.version_info >= (3, 11):
torch/_dynamo/bytecode_analysis.py:222:                sys.version_info < (3, 9) and inst.opcode == dis.opmap["CALL_FINALLY"]
torch/_dynamo/backends/registry.py:102:    if sys.version_info < (3, 10):
torch/_dynamo/types.py:17:if sys.version_info >= (3, 11):
torch/_dynamo/testing.py:344:    if sys.version_info >= (3, 11):
torch/_dynamo/eval_frame.py:506:    if sys.version_info < (3, 11):
torch/_dynamo/eval_frame.py:595:    if sys.version_info >= (3, 12):
torch/_dynamo/test_case.py:24:        or sys.version_info >= (3, 12)
torch/_dynamo/guards.py:123:if sys.version_info[:2] <= (3, 8):
torch/_dynamo/utils.py:1925:    assert sys.version_info >= (3, 11)
```

By using dynamo with python 3.8/3.9, we can obtain suboptimal graphs that don't leverage the latest optimizations coming from latest dynamo. Another side effect is that important third party dependencies may not be optimal for old python too, such as `transformers` and others

### Alternatives

_No response_

### Additional context

_No response_