pytorch
82091d66 - [ONNX] Refactor Input/Output Adapter (#100490)

Commit
1 year ago
[ONNX] Refactor Input/Output Adapter (#100490) This PR refactors how InputAdapter and OutputAdapter is used throughout the exporter. During refactoring, API issues with passes (torch.onnx._internal.fx._pass.Transform) were identified and should be tackled on another API. In short, some passes can modify the input/output of the model and the input/output adapter must be in sync with such change, otherwise, the adapters will not reflect the actual model input/output. The first instance of this issue was with `ReplaceGetAttrWithPlaceholder` pass that adds new inputs to the model. In order to work this around, a new input adapt step to append new inputs (generated by the pass) was introduced. That resulted in the number of inputs of the ONNX model to mismatch the numer of inputs of the pytorch model, though. Follow up on https://github.com/pytorch/pytorch/pull/98421 Pull Request resolved: https://github.com/pytorch/pytorch/pull/100490 Approved by: https://github.com/BowenBao
Author
Thiago Crepaldi
Committer
Parents
Loading