def __init__(self, x_dim, z_dim, h_dim=512): super(Discriminator_2, self).__init__() self.h_dim = h_dim with self.init_scope(): self.l1 = L.Linear(x_dim + z_dim, h_dim, initialW=xavier.Xavier(x_dim + z_dim, h_dim)) self.l2 = L.Linear(h_dim, h_dim, initialW=xavier.Xavier(h_dim, h_dim)) self.l3 = L.Linear(h_dim, 1, initialW=xavier.Xavier(h_dim, 1))
def __init__(self, x_dim, eps_dim, h_dim=512): super(Encoder_4, self).__init__() with self.init_scope(): self.l1 = L.Linear(x_dim + eps_dim, h_dim, initialW=xavier.Xavier(x_dim + eps_dim, h_dim)) self.l2 = L.Linear(h_dim, h_dim, initialW=xavier.Xavier(h_dim, h_dim)) self.l3 = L.Linear(h_dim, eps_dim, initialW=xavier.Xavier(h_dim, eps_dim))
def __init__(self, z_dim, x_dim=1, h_dim=512): super(Decoder_2, self).__init__() with self.init_scope(): self.l1 = L.Linear(z_dim, h_dim, initialW=xavier.Xavier(z_dim, h_dim)) self.l2 = L.Linear(h_dim, h_dim, initialW=xavier.Xavier(h_dim, h_dim)) self.l3 = L.Linear(h_dim, x_dim, initialW=xavier.Xavier(h_dim, x_dim))
def __init__(self, n_in, n_latent, n_h, activation=F.tanh): super(VAE, self).__init__() self.activation = activation with self.init_scope(): # encoder self.le1 = L.Linear(n_in, n_h, initialW=xavier.Xavier(n_in, n_h)) self.le2 = L.Linear(n_h, n_h, initialW=xavier.Xavier(n_h, n_h)) self.le3_mu = L.Linear(n_h, n_latent, initialW=xavier.Xavier(n_h, n_latent)) self.le3_ln_var = L.Linear(n_h, n_latent, initialW=xavier.Xavier(n_h, n_latent)) # decoder self.ld1 = L.Linear(n_latent, n_h, initialW=xavier.Xavier(n_latent, n_h)) self.ld2 = L.Linear(n_h, n_h, initialW=xavier.Xavier(n_h, n_h)) self.ld3_mu = L.Linear(n_h, n_in, initialW=xavier.Xavier(n_h, n_in)) self.ld3_ln_var = L.Linear(n_h, n_in, initialW=xavier.Xavier(n_h, n_in))
def __init__(self, x_dim, eps_dim, h_dim=512): super(Encoder_1, self).__init__() with self.init_scope(): self.a1 = L.Linear(eps_dim, x_dim, initialW=xavier.Xavier(eps_dim, x_dim)) self.a2 = L.Linear(eps_dim, h_dim, initialW=xavier.Xavier(eps_dim, h_dim)) self.a3 = L.Linear(eps_dim, h_dim, initialW=xavier.Xavier(eps_dim, h_dim)) self.l1 = L.Linear(x_dim, h_dim, initialW=xavier.Xavier(eps_dim, h_dim)) self.l2 = L.Linear(h_dim, h_dim, initialW=xavier.Xavier(h_dim, h_dim)) self.l3 = L.Linear( h_dim, eps_dim, initialW=chainer.initializers.Normal(scale=1e-5))