andrewliao11 / CoGAN-tensorflow

Implement Coupled Generative Adversarial Networks in Tensorflow
101 stars 28 forks source link

the code cann't run #7

Closed hzqzzh closed 6 years ago

hzqzzh commented 6 years ago

hello, thank you for make this project! ^_^ in the "ops.py" line 39: with tf.variable_scope(tf.get_variable_scope(), reuse=False):
ema_apply_op = self.ema.apply([batch_mean, batch_var]) but in Signature: tf.variable_scope(name_or_scope, default_name=None, values=None, initializer=None, regularizer=None, caching_device=None, partitioner=None, custom_getter=None, reuse=None, dtype=None, use_resour ce=None) Args: reuse: True or None; if True, we go into reuse mode for this scope as well as all sub-scopes; if None, we just inherit the parent scope reuse.

when I run the code, it said: Traceback (most recent call last): File "main.py", line 51, in tf.app.run() File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 48, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "main.py", line 41, in main dataset_name=FLAGS.dataset, is_crop=FLAGS.is_crop, checkpoint_dir=FLAGS.checkpoint_dir) File "/home/hzq/Glass/GeneGAN_datagate/CoGAN-tensorflow-master/model.py", line 68, in init self.build_model() File "/home/hzq/Glass/GeneGAN_datagate/CoGAN-tensorflow-master/model.py", line 96, in build_model self.G2 = self.generator(self.z, self.y, share_params=True, reuse=False, name='G2') File "/home/hzq/Glass/GeneGAN_datagate/CoGAN-tensorflow-master/model.py", line 308, in generator h0 = prelu(self.g_bn0(linear(z, self.gfc_dim, 'g_h0_lin', reuse=share_params), reuse=share_params), File "/home/hzq/Glass/GeneGAN_datagate/CoGAN-tensorflow-master/ops.py", line 39, in call ema_apply_op = self.ema.apply([batch_mean, batch_var]) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/moving_averages.py", line 375, in apply colocate_with_primary=(var.op.type in ["Variable", "VariableV2"])) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/slot_creator.py", line 174, in create_zeros_slot colocate_with_primary=colocate_with_primary) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/slot_creator.py", line 149, in create_slot_with_initializer dtype) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/slot_creator.py", line 66, in _create_slot_var validate_shape=validate_shape) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variable_scope.py", line 1065, in get_variable use_resource=use_resource, custom_getter=custom_getter) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variable_scope.py", line 962, in get_variable use_resource=use_resource, custom_getter=custom_getter) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variable_scope.py", line 367, in get_variable validate_shape=validate_shape, use_resource=use_resource) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variable_scope.py", line 352, in _true_getter use_resource=use_resource) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variable_scope.py", line 682, in _get_single_variable "VarScope?" % name) ValueError: Variable g_bn0/g_bn0_2/moments_1/Squeeze/ExponentialMovingAverage/ does not exist, or was not created with tf.get_variable(). Did you mean to set reuse=None in VarScope?

my tensorflow version : tf.version = 1.2.1

can you help me? thank you !

andrewliao11 commented 6 years ago

hi please see the requirement here I'll close the issue first. feel free to reopen it.