yunjey / domain-transfer-network

TensorFlow Implementation of Unsupervised Cross-Domain Image Generation
MIT License
861 stars 204 forks source link

Loss functions are deprecated #6

Closed satishrdd closed 4 years ago

satishrdd commented 7 years ago

Most of the functions used are deprecated according to newer version of tensorflow and the following error occurs when i tried to run with older version of tensorflow.

ValueError: Variable discriminator/conv1/weights/Adam/ already exists, disallowed. Did you mean to set reuse=True in VarScope? Originally defined at:

File "/Users/arjun/tensorflow/lib/python2.7/site-packages/tensorflow/contrib/slim/python/slim/learning.py", line 467, in create_train_op grad_updates = optimizer.apply_gradients(grads, global_step=global_step) File "/Users/arjun/dtn-tensorflow/model.py", line 129, in build_model self.d_train_op_src = slim.learning.create_train_op(self.d_loss_src, self.d_optimizer_src, variables_to_train=d_vars) File "/Users/arjun/dtn-tensorflow/solver.py", line 112, in train model.build_model()

Can you look into the issue.I dont have much experience in tensorflow to exactly point out the issue..

Hao-HUST commented 7 years ago

Hi, satishrdd! On my machine, I can run the code correctly, and are you sure that the version of Tensorflow you used to run the code is r0.12?

sunset-clouds commented 7 years ago

can be solved by following process: with tf.variable_scope('source_train_op',reuse=False): self.d_train_op_src = slim.learning.create_train_op(self.d_loss_src, self.d_optimizer_src, variables_to_train=d_vars) self.g_train_op_src = slim.learning.create_train_op(self.g_loss_src, self.g_optimizer_src, variables_to_train=g_vars) self.f_train_op_src = slim.learning.create_train_op(self.f_loss_src, self.f_optimizer_src, variables_to_train=f_vars)

with tf.variable_scope('target_train_op',reuse=False): self.d_train_op_trg = slim.learning.create_train_op(self.d_loss_trg, self.d_optimizer_trg, variables_to_train=d_vars) self.g_train_op_trg = slim.learning.create_train_op(self.g_loss_trg, self.g_optimizer_trg, variables_to_train=g_vars)