summaryrefslogtreecommitdiff
path: root/cli/app/search/search_class.py
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2020-01-08 14:00:32 +0100
committerJules Laplace <julescarbon@gmail.com>2020-01-08 14:00:32 +0100
commit4d236ffc49f377d54d6a8a93e864c52f925c6ee9 (patch)
tree6d336a32c23c5b4da2af1ffb6c2dc2f0d51b832f /cli/app/search/search_class.py
parentca032925551726fbca9e3fffa76aa766fdc37499 (diff)
clip latents differently
Diffstat (limited to 'cli/app/search/search_class.py')
-rw-r--r--cli/app/search/search_class.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/cli/app/search/search_class.py b/cli/app/search/search_class.py
index f7b2136..105fc9f 100644
--- a/cli/app/search/search_class.py
+++ b/cli/app/search/search_class.py
@@ -96,6 +96,8 @@ def find_nearest_vector(sess, generator, opt_fp_in, opt_dims, out_images, out_la
'truncation': input_trunc,
})
+ target = tf.compat.v1.placeholder(tf.float32, shape=(batch_size, img_size, img_size, num_channels))
+
## clip the Z encoding
opt_clip = 1.0
@@ -104,10 +106,10 @@ def find_nearest_vector(sess, generator, opt_fp_in, opt_dims, out_images, out_la
tf.random.uniform([batch_size, z_dim], minval=-opt_clip, maxval=opt_clip), input_z)
clip_latent = tf.assign(input_z, clipped_encoding)
- target = tf.compat.v1.placeholder(tf.float32, shape=(batch_size, img_size, img_size, num_channels))
-
## normalize the Y encoding
- normalized_labels = tf.nn.l2_normalize(input_y)
+ # normalized_labels = tf.nn.l2_normalize(input_y)
+ # tf.reduce_mean(tf.abs(encoding - gen_encoding))
+ normalized_labels = input_y / tf.reduce_sum(input_y)
clip_labels = tf.assign(input_y, normalized_labels)
## if computing Feature loss, use these encoders