예제 #1
0
 def __init__(self, z_dim, output_dim=28**2):
     super(Generator, self).__init__()
     self.z_dim = z_dim
     self.fc1 = nn.Linear(z_dim, 500, bias=False)
     self.bn1 = nn.BatchNorm1d(500, affine=False, eps=1e-6, momentum=0.5)
     self.fc2 = nn.Linear(500, 500, bias=False)
     self.bn2 = nn.BatchNorm1d(500, affine=False, eps=1e-6, momentum=0.5)
     self.fc3 = LinearWeightNorm(500, output_dim, weight_scale=1)
     self.bn1_b = Parameter(torch.zeros(500))
     self.bn2_b = Parameter(torch.zeros(500))
     nn.init.xavier_uniform_(self.fc1.weight)
     nn.init.xavier_uniform_(self.fc2.weight)
예제 #2
0
 def __init__(self, z_dim, output_dim=28**2):
     super(Generator, self).__init__()
     self.z_dim = z_dim
     self.fc1 = Linear(z_dim, 500)
     self.bn1 = tf.keras.layers.BatchNormalization(trainable=False,
                                                   epsilon=1e-6,
                                                   momentum=0.5)
     self.fc2 = Linear(500, 500)
     self.bn2 = tf.keras.layers.BatchNormalization(trainable=False,
                                                   epsilon=1e-6,
                                                   momentum=0.5)
     self.fc3 = LinearWeightNorm(500, output_dim)
     self.bn1_b = tf.Variable(tf.zeros(500))
     self.bn2_b = tf.Variable(tf.zeros(500))
예제 #3
0
 def __init__(self, input_dim=28**2, output_dim=10):
     super(Discriminator, self).__init__()
     self.input_dim = input_dim
     self.layers = torch.nn.ModuleList([
         LinearWeightNorm(input_dim, 1000),
         LinearWeightNorm(1000, 500),
         LinearWeightNorm(500, 250),
         LinearWeightNorm(250, 250),
         LinearWeightNorm(250, 250)
     ])
     self.final = LinearWeightNorm(250, output_dim, weight_scale=1)
예제 #4
0
 def __init__(self, input_dim=28**2, output_dim=10):
     super(Discriminator, self).__init__()
     self.input_dim = input_dim
     self.layers_hidden = [
         LinearWeightNorm(input_dim, 500),
         LinearWeightNorm(500, 500),
         LinearWeightNorm(500, 250),
         LinearWeightNorm(250, 250),
         LinearWeightNorm(250, 250)
     ]
     self.final = LinearWeightNorm(250, output_dim)