[ONNX] Export nn.Module call as ONNX local function (#63589)
* Add new argument to export api to enable users specifying `nn.Module` classes that they wish to be exported as local function in ONNX model.
* Refactor `torch/csrc/jit/serialization/export.cpp`, and remove redundant `EncoderBase` class.
* ~~Contains changes from #63268~~
* Depends on #63716 to update onnx submodule.
Co-authored-by: BowenBao <bowbao@microsoft.com>
ghstack-source-id: 92a95520cee1007c2b6d9c87698aba11b25147a1
Pull Request resolved: https://github.com/pytorch/pytorch/pull/66140