It's a good idea to have visualization tools. Currently, for standard blocks, you can print them directly, though the string representation doesn't reflect the computation graph.
@szha I just find it weird that it exists in symbol and not in gluon.
I understand the underlying differences between the two, but the visualization is nice regardless
You're able to plot if you've got a HybridBlock, since you can convert to a Symbol by hybridizing and passing an input Symbol. A more direct method might be nice though.
import mxnet as mx
net = mx.gluon.nn.HybridSequential()
with net.name_scope():
net.add(mx.gluon.nn.Dense(256, activation="relu"))
net.add(mx.gluon.nn.Dense(256, activation="relu"))
net.add(mx.gluon.nn.Dense(10))
# Option 1
print(net)
# Option 2 (net must be HybridSequential, if want to plot whole graph)
net.hybridize()
net.collect_params().initialize()
x = mx.sym.var('data')
sym = net(x)
mx.viz.plot_network(sym)
We have open-sourced MXBoard which enables users to visualize MXNet data (including network structures) in TensorBoard. The current version on PyPI is 0.1.0rc3. You can either install from source or pip install. The GitHub site has rich examples and tutorials on installation and how to use it in MXNet. Could you try it and give us feedbacks? Thanks.
gluon plot_network will be released in gluoncv 0.5.0. see gluoncv.utils.viz.plot_network
@JustinhoCHN that feature is broken at the moment:
Most helpful comment
You're able to plot if you've got a HybridBlock, since you can convert to a Symbol by hybridizing and passing an input Symbol. A more direct method might be nice though.