afe.load.importers.onnx ======================= .. py:module:: afe.load.importers.onnx Functions --------- .. autoapisummary:: afe.load.importers.onnx.import_onnx_model afe.load.importers.onnx.validate_input_parameters afe.load.importers.onnx.import_onnx_to_tvm Module Contents --------------- .. py:function:: import_onnx_model(file_path: str) Load a ONNX model from a file :param file_path: str. File path to the onnx .onnx file :return: A ONNX model .. py:function:: validate_input_parameters(onnx_file_path: str, shape_dict: Dict[str, Tuple[int, Ellipsis]], dtype_dict: Dict[str, afe.ir.tensor_type.ScalarType]) -> None 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) .. py:function:: 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: Optional[Dict[str, Callable]] = None) -> Tuple[afe._tvm._defines.TVMIRModule, List[str]] 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. :return: Imported TVM IR module and names of the ONNX model's outputs.