Principle:Onnx Onnx IO Map Definition
| Knowledge Sources | |
|---|---|
| Domains | Model_Composition, Data_Flow |
| Last Updated | 2026-02-10 00:00 GMT |
Overview
A connection specification pattern that defines how the outputs of one ONNX model map to the inputs of another model during composition.
Description
When merging two ONNX models, the I/O map specifies which output tensors of the first model should be connected to which input tensors of the second model. This is the fundamental wiring mechanism for model composition: it defines the data flow between the two models. Outputs and inputs not included in the I/O map remain as external inputs/outputs of the merged model.
The I/O map is a user-defined data structure (not a library API) consisting of a list of (output_name, input_name) pairs. Each pair connects one output edge from model 1 to one input edge of model 2.
Usage
Use this principle when defining how two models should be connected during composition. The I/O map must be created before calling merge_models and must reference valid output names from model 1 and valid input names from model 2 (accounting for any prefixes that may have been applied).
Theoretical Basis
The I/O map is formally a relation:
Failed to parse (syntax error): {\displaystyle \text{io\_map} \subseteq \text{outputs}(M_1) \times \text{inputs}(M_2) }
Where each pair means "connect output of model 1 to input of model 2."
The remaining unmatched edges become:
- Merged inputs: Failed to parse (syntax error): {\displaystyle \text{inputs}(M_1) \cup (\text{inputs}(M_2) \setminus \text{range}(\text{io\_map}))}
- Merged outputs: Failed to parse (syntax error): {\displaystyle (\text{outputs}(M_1) \setminus \text{domain}(\text{io\_map})) \cup \text{outputs}(M_2)}