def __init__(self, latent_dim=2, z_prior='gaussian'): self.z_prior = z_prior self.enc_l1 = L.Linear((784, 1000)) self.enc_b1 = L.BatchNormalization(1000) self.enc_l2 = L.Linear((1000, 1000)) self.enc_b2 = L.BatchNormalization(1000) self.enc_l3 = L.Linear((1000, latent_dim)) self.enc_b3 = L.BatchNormalization(latent_dim) self.dec_l1 = L.Linear((latent_dim, 1000)) self.dec_b1 = L.BatchNormalization(1000) self.dec_l2 = L.Linear((1000, 1000)) self.dec_b2 = L.BatchNormalization(1000) self.dec_l3 = L.Linear((1000, 784)) self.D_l1 = L.Linear((latent_dim, 500)) self.D_b1 = L.BatchNormalization(500) self.D_l2 = L.Linear((500, 500)) self.D_b2 = L.BatchNormalization(500) self.D_l3 = L.Linear((500, 1)) self.model_params = self.enc_l1.params + self.enc_l2.params + self.enc_l3.params \ + self.dec_l1.params + self.dec_l2.params + self.dec_l3.params \ + self.enc_b1.params + self.enc_b2.params + self.enc_b3.params \ + self.dec_b1.params + self.dec_b2.params self.D_params = self.D_l1.params + self.D_l2.params + self.D_l3.params self.rng = RandomStreams(seed=numpy.random.randint(1234))
def __init__(self, layer_sizes): self.linear_layers = [] self.bn_layers = [] self.act_layers = [] self.params = [] for m, n in zip(layer_sizes[:-1], layer_sizes[1:]): l = L.Linear(size=(m, n)) bn = L.BatchNormalization(size=(n)) self.linear_layers.append(l) self.bn_layers.append(bn) self.params += l.params + bn.params for i in range(len(self.linear_layers) - 1): self.act_layers.append(L.relu) self.act_layers.append(L.softmax)
def __init__(self): self.l1 = L.Linear(size=(100, 100)) self.l2 = L.Linear(size=(100, 2)) self.params = self.l1.params + self.l2.params
def __init__(self, drate=0.5): self.drate = drate self.l1 = L.Linear(size=(100, 100)) self.l2 = L.Linear(size=(100, 2)) self.params = self.l1.params + self.l2.params