lutzroeder / netron

Visualizer for neural network, deep learning and machine learning models
https://netron.app
MIT License
28.06k stars 2.78k forks source link

xmodel: subgraph support #1118

Closed sh39o closed 1 year ago

sh39o commented 1 year ago

Hi @lutzroeder ,

I've tried to enable the graph.groups in the xmodel.js. And I want to show the properties of each xmodel.Subgraph as subgraph properties on the sidebar after each mouse click, just like node-click do.

image

I've studied the source code of netron and set the graph.groups in the xmodel.js. The netron successfully showed the subgraph.

image

However, the properties of xmodel.Subgraph can't be shown on the sidebar after clicking the subgraph/graph.group. I think that the refactor of the view.js is too complicated for me. I made a pull request on my local fork https://github.com/sh39o/netron/pull/2/files

Can you please give me some advices? Or support the feature in the main branch of netron?

Many Thanks

Best Regards.

lutzroeder commented 1 year ago

@sh39o can you share a sample model file to test the branch.

groups is an experiment using dagre clustering and is deprecated. The approaches used for ONNX functions or nested TensorFlow graph attributes might be worth exploring for nested graphs (see #773 or screenshot below). #68 is tracking hierarchical graph expansion which isn't fully implemented.

image

sh39o commented 1 year ago

Many thanks for explaining. The demo above is very clear and the visual performance is very suitable for showing complex branch structures. Unfortunately, the xmodel doesn't support conditional branch or loop structures. (e.g., Scan, For, If in onnx) for the constraint of xir. If Scan/Loop/If is supported by xir, I'll try to make it visual in netron then :)

I only want to show the attributes of xmodel.Subgraph. Below shows a simple demo with only a conv2d. Since the group is deprecated, I'll try to support the feature locally. Also, I'll close this issue. toy_release.zip

Thanks again for providing great helps!

Best Regards