JonathanRaiman / tensorflow-infogan

:dolls: InfoGAN: Interpretable Representation Learning
154 stars 63 forks source link

Batch Norm Gamma Variable does not exist #5

Open kofzor opened 7 years ago

kofzor commented 7 years ago

ValueError: Variable generator/layer_2/batch_norm/gamma does not exist, or was not created with tf.get_variable(). Did you mean to set reuse=None in VarScope?

I think this has to do with tensorflow 0.12.1, as more people have issues with the variable scope & get_variable.

Do you happen to know what the following line should be? gamma = tf.get_variable("gamma", [shp], initializer=tf.random_normal_initializer(1., 0.02), trainable=trainable)

Whole error:

generator architecture Fully connected with num_outputs=1024 followed by relu Fully connected with num_outputs=6272 followed by relu Reshape to [7, 7, 128] Traceback (most recent call last): File "infogan/init.py", line 487, in train() File "infogan/init.py", line 267, in train debug=True File "infogan/init.py", line 47, in generator_forward strip_batchnorm_from_last_layer=True) File "/home/aiw/software/tensorflow-infogan/infogan/tf_utils.py", line 132, in runnetwork scope='layer%d' % (layer_idx,) File "/home/aiw/anaconda2/lib/python2.7/site-packages/tensorflow/contrib/framework/python/ops/arg_scope.py", line 177, in func_with_args return func(*args, current_args) File "/home/aiw/anaconda2/lib/python2.7/site-packages/tensorflow/contrib/layers/python/layers/layers.py", line 1106, in convolution2d_transpose outputs = normalizer_fn(outputs, normalizer_params) File "/home/aiw/software/tensorflow-infogan/infogan/tf_utils.py", line 39, in conv_batch_norm gamma = tf.get_variable("gamma", [shp], initializer=tf.random_normal_initializer(1., 0.02), trainable=trainable) File "/home/aiw/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 1024, in get_variable custom_getter=custom_getter) File "/home/aiw/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 850, in get_variable custom_getter=custom_getter) File "/home/aiw/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 346, in get_variable validate_shape=validate_shape) File "/home/aiw/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 331, in _true_getter caching_device=caching_device, validate_shape=validate_shape) File "/home/aiw/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 650, in _get_single_variable "VarScope?" % name) ValueError: Variable generator/layer_2/batch_norm/gamma does not exist, or was not created with tf.get_variable(). Did you mean to set reuse=None in VarScope?

howardgriffin commented 7 years ago

I have the similar problem,how did you solve the problem?And here is my error ValueError: Variable discriminator/layer_0/batch_norm/discriminator_1/layer_0/batch_norm/discriminator_1/layer_0/batch_norm/moments/normalize/mean/ExponentialMovingAverage/biased does not exist, or was not created with tf.get_variable(). Did you mean to set reuse=None in VarScope?