[Relay][Onnx] Support saveing relay ir to onnx for visualization

relay ir may not be easy to be viewed in netron. Awareness of distinct Attr types is required in some solutions.

this commit([relay][feature] save relay IR as onnx for visualize by ShawnZhuang · Pull Request #16847 · apache/tvm · GitHub) provide a method to serializing relay ir to protobuf for visualization.

  1. it provide a general method to retrieve member variables of any Attrs without having exact knowledge of it, which reference the implementation of relay_text_printer
  2. the protobuf use the defination of onnx-ml.pb, and could be opened by netron naturally.

there are some piture of the ut:

example: conv with constant weight:

example: meshgrid and tuple ( various input and various output, test Tuple and TupleGetItem)

example: a simple network

1 Like