报错:
"…(Module)"object has no attribute “n_channels”(or n_classes)
解决方法:
加上
self.n_channels = n_channels
self.n_classes = n_classes
class XXX(nn.Module):
def __init__(self, n_channels, n_classes):
super(XXX, self).__init__()
self.n_channels = n_channels
self.n_classes = n_classes