Esempio n. 1
0
    G_X,
    data.dim_X,
    Z,
)

view_dist = view_dist_setup(X, Z)
view_disentangle = view_disentangle_setup(
    X,
    G_X,
    data.dim_X,
    Z,
)

sess = tf.Session()
sess.run(tf.global_variables_initializer())
data_feed = default_feeder(data, X, mb_size)
print(sess.run([recon_loss, tf.reduce_mean(kl_losses)], feed_dict=data_feed))
run_ae(data=data,
       mb_size=mb_size,
       interpolation=interpolation,
       feature_eval=None,
       view_dist=view_dist,
       view_disentangle=view_disentangle,
       train=train,
       loss=loss,
       X=X,
       G_X=G_X,
       sess=sess,
       experiment_id=name,
       max_iter=10000000)
Esempio n. 2
0
train_G = tf.train.AdamOptimizer(lr).minimize(recon_loss,
                                              var_list=vars_G + vars_E)
train_E = tf.train.AdamOptimizer(lr).minimize(G_loss, var_list=vars_E)
print([_.name for _ in tf.get_collection(tf.GraphKeys.GLOBAL_VARIABLES)])
train = tf.group(train_D, train_E, train_G)

sess = tf.Session()
view_dist = view_dist_setup(X, Z)

view_disentangle = view_disentangle_setup(
    X,
    G_X,
    data.dim_X,
    Z,
)

sess.run(tf.global_variables_initializer())
data_feed = default_feeder(data, X, mb_size)
run_ae(data=data,
       mb_size=mb_size,
       interpolation=None,
       view_disentangle=view_disentangle,
       view_dist=view_dist,
       feature_eval=None,
       train=train,
       loss=recon_loss,
       X=X,
       G_X=G_X,
       sess=sess,
       experiment_id=name)
Esempio n. 3
0
        tf.reduce_sum((Xt_mean - X__)**2, axis=(1, 2, 3)))
    recon_loss += recon_loss_t

G_X = X_means[0]
loss = recon_loss + kl_loss / T

train = tf.train.AdamOptimizer(learning_rate=1e-4).minimize(loss)
print([_.name for _ in tf.get_collection(tf.GraphKeys.GLOBAL_VARIABLES)])

sess = tf.Session()
interpolation = interpolation_setup(
    X,
    G_X,
    data.dim_X,
    Zs[0],
)

sess.run(tf.global_variables_initializer())
data_feed = default_feeder(data, X, mb_size)
print(sess.run([recon_loss, kl_loss], feed_dict=data_feed))
run_ae(data=data,
       mb_size=mb_size,
       interpolation=interpolation,
       feature_eval=None,
       train=train,
       loss=loss,
       X=X,
       G_X=G_X,
       sess=sess,
       experiment_id=name)
Esempio n. 4
0
with tf.variable_scope('G'):
    # G_logits = nets.dense_net(Z, [256, data.dim_x], batch_norm=True)
    G_logits = nets.deconv64(Z)
    G_X = tf.nn.sigmoid(G_logits)

loss = tf.reduce_mean(
    tf.nn.sigmoid_cross_entropy_with_logits(logits=G_logits, labels=X__))

train = tf.train.RMSPropOptimizer(learning_rate=1e-4).minimize(loss)
print([_.name for _ in tf.get_collection(tf.GraphKeys.GLOBAL_VARIABLES)])

sess = tf.Session()
feature_eval = feature_eval_setup(sess,
                                  X,
                                  Z,
                                  data.sample(1000),
                                  data_test.sample(1000),
                                  accuracy,
                                  nets.smcewl,
                                  max_iter=1000)
sess.run(tf.global_variables_initializer())
run_ae(data=data,
       mb_size=mb_size,
       feature_eval=feature_eval,
       train=train,
       loss=loss,
       X=X,
       G_X=G_X,
       sess=sess,
       experiment_id=name)