mxnet工具类

profiler

官方http://mxnet.incubator.apache.org/architecture/release_note_0_9.html?highlight=profiler

profiler可以用来分析mxnet的性能,比如计算中每一个算子前向所花的时间

主要步骤包括设置profiler:

  • 1
    2
    3
    4

    profiler开始:

    * ```mx.profiler.profiler_set_state('run')

profiler结束:

  • 1
    2
    3
    4

    ### 网络可视化

    ```mx.viz.plot_network(net)```或者```mx.viz.plot_network(sym).view()

可视化之前记得在系统上安装graphviz,

apt-get install graphviz```
1
2

- 使用gluon可视化网络

block = NASNetALarge(1000)
mx.viz.plot_network(block(mx.sym.var(“x”)))

1
2

- notebook保存图片

net_dot = mx.viz.plot_network(net, save_format=’png’)
net_dot.save(‘test.dot’)

1
2

### 显示网络的每一层参数

mx.viz.print_summary(net,{“data”:(32,3,192,192),})
`