
- 一、torchsummary模块
- 二、torchstat模块
- 三、model.children()和model.modules()
- 四、model.parameters()和model.named_parameters()
- 五、model.state_dict()
- 六、m.__class__.__name__
获取module的classname。
import torch
conv = torch.nn.Conv2d(1,8,3,1)
bn = torch.nn.BatchNorm2d(8)
l = [conv,bn]
for item in l:
print(item.__class__.__name__)
# 输出结果:
# Conv2d
# BatchNorm2d
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)