def __init__(self, num_features=64, dim_z=128, bottom_width=6, activation=F.relu, num_classes=0, bottleneck=False): super(ResNetGenerator48, self).__init__() self.num_features = num_features self.dim_z = dim_z self.bottom_width = bottom_width self.activation = activation self.num_classes = num_classes self.l1 = nn.Linear(dim_z, 8 * num_features * bottom_width**2) self.block2 = GenBlock(num_features * 8, num_features * 4, activation=activation, upsample=True, num_classes=num_classes, bottleneck=bottleneck) self.block3 = GenBlock(num_features * 4, num_features * 2, activation=activation, upsample=True, num_classes=num_classes, bottleneck=bottleneck) self.block4 = GenBlock(num_features * 2, num_features, activation=activation, upsample=True, num_classes=num_classes, bottleneck=bottleneck) self.b5 = nn.BatchNorm2d(num_features) self.conv5 = nn.Conv2d(num_features, 3, 1, 1)
def __init__(self, num_features=256, dim_z=128, channel=3, bottom_width=4, activation=F.relu, num_classes=0, distribution='normal'): super(ResNetGenerator32, self).__init__() self.num_features = num_features self.dim_z = dim_z self.bottom_width = bottom_width self.activation = activation self.num_classes = num_classes self.distribution = distribution self.l1 = nn.Linear(dim_z, num_features * bottom_width**2) self.block2 = GenBlock(num_features, num_features, activation=activation, upsample=True, num_classes=num_classes) self.block3 = GenBlock(num_features, num_features, activation=activation, upsample=True, num_classes=num_classes) self.block4 = GenBlock(num_features, num_features, activation=activation, upsample=True, num_classes=num_classes) self.b5 = nn.BatchNorm2d(num_features) self.conv5 = nn.Conv2d(num_features, channel, 1, 1)
def __init__(self, num_features=64, dim_z=128, bottom_width=4, activation=F.relu, num_classes=0, distribution='normal'): super(ResNetGenerator64, self).__init__() self.num_features = num_features self.dim_z = dim_z self.bottom_width = bottom_width self.activation = activation self.num_classes = num_classes self.distribution = distribution self.l1 = nn.Linear(dim_z, 16 * num_features * bottom_width**2) self.block2 = GenBlock(num_features * 16, num_features * 8, activation=activation, upsample=True, num_classes=num_classes) self.block3 = GenBlock(num_features * 8, num_features * 4, activation=activation, upsample=True, num_classes=num_classes) self.block4 = GenBlock(num_features * 4, num_features * 2, activation=activation, upsample=True, num_classes=num_classes) self.block5 = GenBlock(num_features * 2, num_features, activation=activation, upsample=True, num_classes=num_classes) self.b6 = nn.BatchNorm2d(num_features) self.conv6 = nn.Conv2d(num_features, 3, 1, 1) self._initialize()