Closed lcj820 closed 6 years ago
Which dataset?
I solved this issue by explicitly making the input_height and output_height equivalent. The generator is producing an image that is 64x64 while the discriminator takes images of size 108x108. So if you try to share parameters, it will fail.
Traceback (most recent call last): File "main.py", line 124, in
tf.app.run()
File "/home/li/tensorflow/lib/python3.4/site-packages/tensorflow/python/platform/app.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "main.py", line 101, in main
test_dir = FLAGS.test_dir)
File "/home/li/gan/AnoGAN-master/model.py", line 75, in init
self.build_model()
File "/home/li/gan/AnoGAN-master/model.py", line 116, in buildmodel
self.D, self.Dlogits = self.discriminator(self.G, self.y, reuse=True)
File "/home/li/gan/AnoGAN-master/model.py", line 283, in discriminator
h4 = linear(tf.reshape(h3, [batch_size, -1]), 1, 'd_h4_lin')
File "/home/li/gan/AnoGAN-master/ops.py", line 80, in linear
tf.random_normal_initializer(stddev=stddev))
File "/home/li/tensorflow/lib/python3.4/site-packages/tensorflow/python/ops/variable_scope.py", line 1065, in get_variable
use_resource=use_resource, custom_getter=custom_getter)
File "/home/li/tensorflow/lib/python3.4/site-packages/tensorflow/python/ops/variable_scope.py", line 962, in get_variable
use_resource=use_resource, custom_getter=custom_getter)
File "/home/li/tensorflow/lib/python3.4/site-packages/tensorflow/python/ops/variable_scope.py", line 367, in get_variable
validate_shape=validate_shape, use_resource=use_resource)
File "/home/li/tensorflow/lib/python3.4/site-packages/tensorflow/python/ops/variable_scope.py", line 352, in _true_getter
use_resource=use_resource)
File "/home/li/tensorflow/lib/python3.4/site-packages/tensorflow/python/ops/variable_scope.py", line 669, in _get_single_variable
found_var.get_shape()))
ValueError: Trying to share variable discriminator/d_h4_lin/Matrix, but specified shape (8192, 1) and found shape (25088, 1).