afe.load.importers.onnx
Functions
|
Load a ONNX model from a file |
|
Validates the user supplied input. |
|
Use TVM frontend to import a onnx model into TVM Relay IR |
Module Contents
- afe.load.importers.onnx.import_onnx_model(file_path: str)[source]
Load a ONNX model from a file :param file_path: str. File path to the onnx .onnx file :return: A ONNX model
- afe.load.importers.onnx.validate_input_parameters(onnx_file_path: str, shape_dict: Dict[str, Tuple[int, Ellipsis]], dtype_dict: Dict[str, afe.ir.tensor_type.ScalarType]) None [source]
Validates the user supplied input. :param onnx_file_path: filepath to the onnx .onnx file :param shape_dict: dictionary of input names to input shapes (eg. (1,224,224,3)) :param dtype_dict: dictionary of input names to input types (eg. float32 or int64)
- afe.load.importers.onnx.import_onnx_to_tvm(onnx_file_path: str, shape_dict: Dict[str, Tuple[int, Ellipsis]], dtype_dict: Dict[str, afe.ir.tensor_type.ScalarType], custom_convert_map: Dict[str, Callable] | None = None) Tuple[afe._tvm._defines.TVMIRModule, List[str]] [source]
Use TVM frontend to import a onnx model into TVM Relay IR :param onnx_file_path: filepath to the onnx .onnx file :param shape_dict: dictionary of input names to input shapes (eg. (1,224,224,3)) :param dtype_dict: dictionary of input names to input types (eg. float32 or int64) :param custom_convert_map: A custom op conversion map that maps operation names to functions. Whenever an operator
with a name found in the custom_convert_map is found in TVM, the function is called with 3 arguments
inputs = a tvm onnx_input object which contains a dictionary of tvm function inputs attr = a dictionary of operation attributes params = a dictionary of all the constants in the onnx network
The function then returns the tvm relay IR expression that is inserted into the model wherever the operation occurs.
- Returns:
Imported TVM IR module and names of the ONNX model’s outputs.