paddle直接打印网络真是方便
收藏
有次误操作直接打印了一个网络对象(继承自nn.Layer),结果有惊喜。网络直接输出这样的结果
Generator(
(gen): Sequential(
(0): Conv2DTranspose(100, 256, kernel_size=[4, 4], data_format=NCHW)
(1): BatchNorm2D(num_features=256, momentum=0.9, epsilon=1e-05)
(2): ReLU(name=True)
(3): Conv2DTranspose(256, 128, kernel_size=[4, 4], stride=[2, 2], padding=1, data_format=NCHW)
(4): BatchNorm2D(num_features=128, momentum=0.9, epsilon=1e-05)
(5): ReLU(name=True)
(6): Conv2DTranspose(128, 64, kernel_size=[4, 4], stride=[2, 2], padding=1, data_format=NCHW)
(7): BatchNorm2D(num_features=64, momentum=0.9, epsilon=1e-05)
(8): ReLU(name=True)
(9): Conv2DTranspose(64, 1, kernel_size=[4, 4], stride=[2, 2], padding=1, data_format=NCHW)
(10): Tanh()
)
)
0
收藏
请登录后评论
感觉这个比summary有时还方便
summary主要看参数量,而直接打印nn.Layer对象可以查看各个子层的接口参数
这个很方便检查网络配置错误
尤其是在用Sequential组网时
画网络图也方便
嗯,配置一目了然