pytorch获取module的classname

import torch
conv = torch.nn.Conv2d(1,8,(2,3))
bn = torch.nn.BatchNorm2d(8)
l = [conv,bn]
for item in l:
    print(item.__class__.__name__)

输出结果:
Conv2d
BatchNorm2d

你可能感兴趣的:(Conv2d,Module,pytorch)