Converter¶
Module that converts ExportedProgram to IR.
converter ¶
IR Builder/Converter - converts ExportedProgram to IR.
ConversionError ¶
Bases: Exception
Raised when IR conversion fails.
convert_node ¶
Convert a single FX node to an OpNode.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node_info
|
NodeInfo
|
The analyzed node information. |
required |
Returns:
| Type | Description |
|---|---|
OpNode
|
The converted OpNode. |
Source code in torch_ir/converter.py
convert_exported_program ¶
convert_exported_program(exported: ExportedProgram, model_name: str = '', strict: bool = False) -> IR
Convert an ExportedProgram to IR.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exported
|
ExportedProgram
|
The exported program from torch.export. |
required |
model_name
|
str
|
Optional name for the model. |
''
|
strict
|
bool
|
If True, raise error for unsupported ops. If False, use default conversion. |
False
|
Returns:
| Type | Description |
|---|---|
IR
|
The converted IR. |
Raises:
| Type | Description |
|---|---|
ConversionError
|
If strict mode and unsupported operation encountered. |