I am trying to build a VAE network in which I want the model to do different things in different modes. I have three modes: "train", "same" and "different" and a function named interpolation(mode) that does different things depend on the mode. My code looks like:
import tensorflow as tf
### some code here
mode = tf.placeholder(dtype = tf.string, name = "mode")
def interpolation(mode):
if mode == "train":
# do something
print("enter train mode")
elif mode == "same":
# do other things
print("enter same mode")
else:
# do other things
print("enter different mode")
# some other code here
sess.run(feed_dict = {mode: "train"})
sess.run(feed_dict = {mode: "same"})
sess.run(feed_dict = {mode: "different"})
But the output looks like:
enter different mode
enter different mode
enter different mode
which means the mode that gets passed in doesn't change the condition. What have I done wrong? How do I select mode by string argument?