prototype conditional pipeline
This commit is contained in:
@@ -53,10 +53,10 @@ class Generator(tf.keras.Model):
|
||||
self.w_avg.assign(lerp(batch_avg, self.w_avg, self.w_ema_decay))
|
||||
return
|
||||
|
||||
def style_mixing_regularization(self, latents1, labels, w_broadcasted1):
|
||||
def style_mixing_regularization(self, latents1, conditions, w_broadcasted1):
|
||||
# get another w and broadcast it
|
||||
latents2 = tf.random.normal(shape=tf.shape(latents1), dtype=tf.dtypes.float32)
|
||||
dlatents2 = self.g_mapping([latents2, labels])
|
||||
dlatents2 = self.g_mapping([latents2, conditions])
|
||||
w_broadcasted2 = self.broadcast(dlatents2)
|
||||
|
||||
# find mixing limit index
|
||||
@@ -89,14 +89,14 @@ class Generator(tf.keras.Model):
|
||||
return truncated_w_broadcasted
|
||||
|
||||
def call(self, inputs, ret_w_broadcasted=False, truncation_psi=1.0, truncation_cutoff=None, training=None, mask=None):
|
||||
latents, labels = inputs
|
||||
latents, conditions = inputs
|
||||
|
||||
dlatents = self.g_mapping([latents, labels])
|
||||
dlatents = self.g_mapping([latents, conditions])
|
||||
w_broadcasted = self.broadcast(dlatents)
|
||||
|
||||
if training:
|
||||
self.update_moving_average_of_w(w_broadcasted)
|
||||
w_broadcasted = self.style_mixing_regularization(latents, labels, w_broadcasted)
|
||||
w_broadcasted = self.style_mixing_regularization(latents, conditions, w_broadcasted)
|
||||
|
||||
if not training:
|
||||
w_broadcasted = self.truncation_trick(w_broadcasted, truncation_psi, truncation_cutoff)
|
||||
|
||||
Reference in New Issue
Block a user