# Confusing annotation in relax onnx frontend!

**URL:** <https://discuss.tvm.apache.org/t/confusing-annotation-in-relax-onnx-frontend/15692>\
**Category:** unity\
**Created:** [September 14, 2023, 3:31am UTC](https://discuss.tvm.apache.org/t/confusing-annotation-in-relax-onnx-frontend/15692 "2023-09-14T03:31:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anders](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/anders/32/6011_2.png) [@anders](https://discuss.tvm.apache.org/u/anders)\
**Post date:** [September 14, 2023, 3:31am UTC](https://discuss.tvm.apache.org/t/confusing-annotation-in-relax-onnx-frontend/15692/1 "2023-09-14T03:31:05Z")

</div>

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. 😜[tvm/python/tvm/relax/frontend/onnx/onnx\_frontend.py at unity · apache/tvm (github.com)](https://github.com/apache/tvm/blob/unity/python/tvm/relax/frontend/onnx/onnx_frontend.py)

```
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
    ...
```

---

<div class="post-metadata">

**Author:** ![Hzfengsy](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/hzfengsy/32/2961_2.png) [@Hzfengsy](https://discuss.tvm.apache.org/u/Hzfengsy)\
**Post date:** [September 14, 2023, 5:21am UTC](https://discuss.tvm.apache.org/t/confusing-annotation-in-relax-onnx-frontend/15692/2 "2023-09-14T05:21:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![anders](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/anders/32/6011_2.png) [@anders](https://discuss.tvm.apache.org/u/anders)\
**Post date:** [September 14, 2023, 6:26am UTC](https://discuss.tvm.apache.org/t/confusing-annotation-in-relax-onnx-frontend/15692/3 "2023-09-14T06:26:49Z")

</div>

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