Confusing annotation in relax onnx frontend!

I found two confusing annotation in relax/frontend/onnx/onnx_frontend.py。 in public function from_onnx(),the model’s type should be onnx.onnx_ml_pb2.ModelProto,as we will take its graph member, and in class ONNXGraphImporter.from_onnx(),the type of graph should be onnx.onnx_ml_pb2.GraphProto。 but in onnx_frontend.py file, the two “from_onnx()” annotations are totally reversed! which may confusing readers, hope the tvm official will modify it later. :stuck_out_tongue_winking_eye: tvm/python/tvm/relax/frontend/onnx/onnx_frontend.py at unity · apache/tvm (github.com)

class ONNXGraphImporter:
    ...
    def from_onnx(self, graph: onnx.onnx_ml_pb2.ModelProto, opset: int) -> IRModule:
    ...

def from_onnx(
    model: onnx.onnx_ml_pb2.GraphProto,
    shape_dict: Optional[Dict[str, List]] = None,
    dtype_dict: Optional[Union[str, Dict[str, str]]] = "float32",
    opset: int = None,
    keep_params_in_input: bool = False,
    sanitize_input_names: bool = True,
) -> Tuple[IRModule, Dict]:
    """Convert a ONNX model into an equivalent Relax Function.
    ONNX graphs are represented as Python Protobuf objects.

    The current implementation assumes that the input model is after ONNX v1.1.0.

    Parameters
    ----------
    model : protobuf object
        ONNX ModelProto after ONNX v1.1.0
    ...
1 Like

Sorry for the mistake. Could you please send a PR to fix it?

see this PR: [Unity][Frontend][Onnx] implement Not Op Converter, and modify some a… by brainternet · Pull Request #15744 · apache/tvm (github.com)

2 Likes