Esempio n. 1
0
 def __init__(self, k1=2, c1=40, k2=2, c2=100, d1=96, d2=10):
     super(Generator, self).__init__()
     self.convt1 = ComplexConvTranspose2d(c1, 1, k1, 1, padding=0)
     self.bn = ComplexBatchNorm2d(c1)
     self.convt2 = ComplexConvTranspose2d(c2, c1, k2, 1,
                                          padding=0)  # k = 2,p' = k - 1
     self.c2 = c2
     self.fc1 = ComplexLinear(d1, 2 * 2 * c2)
     self.fc2 = ComplexLinear(10, d1)
Esempio n. 2
0
 def __init__(self, k1=2, c1=40, k2=2, c2=100, k3=3, c3=3, d1=96, d2=10):
     super(Encoder_f, self).__init__()
     self.conv1 = ComplexConv2d(1, c1, k1, 1, padding=0)
     self.bn1 = ComplexBatchNorm2d(c1)
     self.conv2 = ComplexConv2d(c1, c2, k2, 1, padding=0)
     self.bn2 = ComplexBatchNorm2d(c2)
     self.conv3 = ComplexConv2d(c2, c3, k3, 1, padding=0)
     self.fc1 = ComplexLinear(2 * 2 * c3, d1)
     self.fc2 = ComplexLinear(d1, d2)
     self.c3 = c3
Esempio n. 3
0
    def __init__(self):
        super(ComplexGenerator, self).__init__()
        # torch.nn.ConvTranspose2d(in_channels, out_channels, kernel_size, stride=1,
        # padding=0, output_padding=0, groups=1, bias=True, dilation=1)

        # input(N, C_in, H_in, W_in), output(N, C_out, H_out, W_out)
        # H_out=(H_in−1)×stride[0]−2×padding[0] + kernel_size[0] + output_padding[0]
        self.size = 16384
        self.size1 = int(self.size * 0.125)
        self.size2 = int(self.size * 0.25)
        self.size3 = int(self.size * 0.5)

        self.dense1 = ComplexLinear(100, self.size1)
        self.batchnorm1 = ComplexBatchNorm1d(self.size1)
        self.dense2 = ComplexLinear(self.size1, self.size2)
        self.batchnorm2 = ComplexBatchNorm1d(self.size2)
        self.dense3 = ComplexLinear(self.size2, self.size3)
        self.batchnorm3 = ComplexBatchNorm1d(self.size3)
        self.dense4 = ComplexLinear(self.size3, self.size)
Esempio n. 4
0
    def __init__(self):
        super(ComplexDiscriminator, self).__init__()
        # torch.nn.Conv2d(in_channels, out_channels, kernel_size, stride=1,
        # padding=0, dilation=1, groups=1, bias=True)

        # input(N, C_in, H_in, W_in), output(N, C_out, H_out, W_out)
        # H_out=[H_in + 2×padding[0] - dilation[0]×(kernel_size[0]−1) − 1]/stride[0] + 1

        self.conv1 = ComplexConv2d(1, 64, 4, 2, 1)
        self.conv2 = ComplexConv2d(64, 128, 4, 2, 1)
        self.conv3 = ComplexConv2d(128, 256, 4, 2, 1)
        self.conv4 = ComplexConv2d(256, 512, 4, 2, 1)
        self.conv5 = ComplexConv2d(512, 1024, 4, 2, 1)
        self.dense = ComplexLinear(1024 * 4 * 4, 1)
Esempio n. 5
0
    def __init__(self):
        super(ComplexGenerator, self).__init__()
        # torch.nn.ConvTranspose2d(in_channels, out_channels, kernel_size, stride=1,
        # padding=0, output_padding=0, groups=1, bias=True, dilation=1)

        # input(N, C_in, H_in, W_in), output(N, C_out, H_out, W_out)
        # H_out=(H_in−1)×stride[0]−2×padding[0] + kernel_size[0] + output_padding[0]

        self.dense = ComplexLinear(100, 1024 * 4 * 4)
        self.deconv1 = ComplexConvTranspose2d(
            1024, 512, 4, 2, 1)  # (1024, 4, 4) --> (512, 8, 8)
        self.deconv2 = ComplexConvTranspose2d(
            512, 256, 4, 2, 1)  # (512, 8, 8) --> (256, 16, 16)
        self.deconv3 = ComplexConvTranspose2d(
            256, 128, 4, 2, 1)  # (256, 16, 16) --> (128, 32, 32)
        self.deconv4 = ComplexConvTranspose2d(
            128, 64, 4, 2, 1)  # (128, 32, 32) --> (64, 64, 64)
        self.deconv5 = ComplexConvTranspose2d(
            64, 1, 4, 2, 1)  # (64, 64, 64) --> (1, 128, 128)
Esempio n. 6
0
 def __init__(self, encoder, decoder):
     super(VAE, self).__init__()
     self.encoder = encoder
     self.decoder = decoder
     self._enc_mu = ComplexLinear(200, latent_dim)
     self._enc_log_sigma = ComplexLinear(200, latent_dim)