AlamiMejjati / Unsupervised-Attention-guided-Image-to-Image-Translation

Unsupervised Attention-Guided Image to Image Translation
MIT License
329 stars 47 forks source link

There is still instance normalization in generator #8

Open tr3e opened 5 years ago

tr3e commented 5 years ago

There is still instance normalization in generator though the argument tf.constant(False), is it a bug?

tr3e commented 5 years ago

I printed the trainable variables and found there is instance_norm in block 'c1', 'c2' and 'c3' of generator with mask.

AlamiMejjati commented 5 years ago

This is normal. Instance norm is in that case performed using tf.cond, which is the TensorFlow equivalent of an If statement. When using tf.cond Tensorflow builds the graph for the two outcomes of tf.cond, the first outcome being the one corresponding to the True statement and the second one corresponding to the False statement. Tensorflow is obliged to do that as it is graph based. With that in mind it is normal to find the instance norm variables in tf.trainable_variables, however at computation time, the data flow does not go through the instance norm branch.

tr3e commented 5 years ago

This is normal. Instance norm is in that case performed using tf.cond, which is the TensorFlow equivalent of an If statement. When using tf.cond Tensorflow builds the graph for the two outcomes of tf.cond, the first outcome being the one corresponding to the True statement and the second one corresponding to the False statement. Tensorflow is obliged to do that as it is graph based. With that in mind it is normal to find the instance norm variables in tf.trainable_variables, however at computation time, the data flow does not go through the instance norm branch.

Understood.

This is normal. Instance norm is in that case performed using tf.cond, which is the TensorFlow equivalent of an If statement. When using tf.cond Tensorflow builds the graph for the two outcomes of tf.cond, the first outcome being the one corresponding to the True statement and the second one corresponding to the False statement. Tensorflow is obliged to do that as it is graph based. With that in mind it is normal to find the instance norm variables in tf.trainable_variables, however at computation time, the data flow does not go through the instance norm branch.

Thank you.